Redirect from removed page htaccess - .htaccess

I need to redirect https://example.com/?lang=eng to https://example.com/english.html
The problem is that the page https://example.com/?lang=eng doesn't exist anymore, the site was written in php and it was changed to pure html css.
An ordinary redirect like this doesn't work!
Redirect 301 https://example.com/?lang=eng https://example.com/english.html
It is important to redirect this page because I have a lot of external links pointing to it.

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.

Need help redirecting one website URL to another with apache2 and .htaccess

I have two domains - https://hosting.opensimcity.org, and http://paradigm.pocketmud.com and I want to redirect the latter to the former. That is, when someone connects to http://paradigm.pocketmud.com I want it to redirect to https://hosting.opensimcity.org/paradigm
Any tips on doing this in my .htaccess file?
Just try the following htaccess redirect code:
Redirect 301 / https://hosting.opensimcity.org/paradigm
This 301 redirect response notifies the search engines that the page has moved permanently from the old URL to the new URL. The search engines also transfer the old URL page rank to the new URL.

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.

Redirecting URLs to a new subdomain with Open Cart

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!

htaccess Redirect URL of Subdirectories managed through CMS

All the urls of our site are written www.mydomain.com/sub1/cms/pagename
Through the CMS we can specify pagename
sub1 and cms are not actually directories on the server.
We need to change the pagenames to be more SEO friendly, but we still want any traffic to the old pagename to direct to the new one.
I have tried making an .htaccess file specifying:
Redirect 301 /sub1/cms/oldpagename mydomain.com/sub1/cms/newpagename
but it does not work.
I have been successful with:
Redirect 301 /oldpagename mydomain.com/sub1/cms/newpagename
Can this be done somehow through .htaccess?
First, make sure your 301 redirect rules for redirect use a full url including the http:// portion.
Redirect 301 /sub1/cms/oldpagename http://mydomain.com/sub1/cms/newpagename
Second, it sounds to me like your CMS has put a rewrite rule in place to handle the /sub1/cms/pagename style urls. If this rule comes before your redirect, your redirect will never get triggered. Try moving your redirect to the top of the .htaccess file.

Resources