Redirecting URLs to a new subdomain with Open Cart - .htaccess

I have recently moved a client's e-commerce Open Cart site from theirdomain.com to shop.theirdomain.com and replaced theirdomain.com with a standard local business wordpress site.
The move went smoothly, however there are a number of pages from the original theirdomain.com that are still indexed in Google and are displaying 404 errors obviously.
I want to add 301 redirects to these pages in the htacess file to their respective subdomain pages, but when I tried the following code, the redirect worked, but the page wouldn't load properly.
Redirect 301 /carb-caps http://shop.theirdomain.com/carb-caps
It would take me to a page like this http://shop.theirdomain.com/carb-caps?route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps
I understand that this is typical of Open Cart...
The page loads fine without the redirect in place, but as soon as I add the redirect to the htaccess file, it just doesn't load.
Any ideas?
Thanks in advance!

Related

TYPO3 10 .htaccess redirect old links to new links not working

While updating a website (completely new page tree, IDs have changed), the old links need to redirect to the new links. Domain stays the same.
This is the first thing I write in my .htaccess
RewriteEngine on
Redirect 301 /index.php?id=5 /contact
Redirect 301 /test.html /xy.html
Redirect 301 /index.php?id=6 /imprint
# and many more
test.html successfully links to xy.html (just a test, they don't even exist and correctly show the 404 page)
the index.php?id=x redirects however do not work. They actually still open whatever new page has this ID.
I don't understand why it's not working. Is TYPO3 interfering? I though I would be safe if I write it as the first thing in my .htaccess.
TYPO3 does not interfere as the rules in the .htaccess file are evaluated before.
Another option could be to use the redirect module of TYPO3 for creating the redirects. Those can then be created in the backend and maintained by editors. A small drawback is that performance is not that perfect as in .htaccess but it is much more convenient.

htaccess redirect specific pages to another domain

I’m having some real problems with 301 redirects in my .htaccess file.
I have about 20 pages on an old site that I need to redirect to pages on a new site. The URL structure of the new site is totally different.
Here’s one that I tried:
Redirect 301 /dan-carr-gear-list/travel-gear https://dancarrphotography.com/gear/travel/
Unfortunately, this doesn’t work.
What happens is that you get redirected to https://dancarrphotography.com/gear/travel-gear/ for some reason.
I just can’t figure it out.

301 redirects keep going to page not found

I am currently working on a website. I was not the developer but i am doing the fixes. The plugin simple 301 redirect is being used to redirect the dead site pages to the new live site. The issue is that even tho the url's for the old site is correct and so are the new ones, some of the old url's redirect properly but others are going to page not found. Any advise?

301 redirects not working properly. Numbers in URL being ignored

I have just replaced my old non-Wordpress site with a Wordpress site. Now I need to redirect approximately 400 old URLs to their equivalent pages on the new site.
I have already recorded all the old urls and new urls, but when I put the code in the .htaccess file I am getting a strange result.
If I try to redirect to any url that has a number in it, the redirect tries to redirect to that url minus the numbers.
For example:
Redirect 301 /international_organizations/africaamerica_institute http://nyintl.net/international-organizations-in-new-york/2792/africa-america-institute/
Redirects to http://nyintl.net/international-organizations-in-new-york/africa-america-institute/
Which isn't actually a page and thus returns a 404 error.
Anyone have any idea what's going wrong? All my posts on the new site have the month/year syntax in the url, so this means that 95% of my redirects aren't working.
All the urls that don't contain numbers are redirecting perfectly.
I have made sure to put all my redirects ABOVE the WP rewrite rules, but that hasn't made a difference (tried them below as well).

.htaccess redirect homepage only to mobile

I am extremely new to .htaccess files, I am still in the learning process and am copying code that I find around the web to do what I want. Currently I would like to redirect my homepage ONLY via an .htaccess file in the root directory to a mobile version of the homepage. For example, www.mysite.com (which is also www.mysite.com/index.html) gets redirected to www.mysite.com/mobile on mobile devices. The other pages on my site such as www.mysite.com/page1 stay intact and do not undergo a redirect. The few snippets that I tried worked fine for the homepage to /mobile, but then if the user clicked on a link to take them to another page in the site, they got again redirected to the mobile home page forming an endless loop. Any help would be greatly appreciated, and again I'm very new to all of this. Thank you so much for your time.

Resources