Sun 22 Mar |
|
The standard Apache 301 domain redirect ( page to page after a domain change) gives a 404 on Litespeed after the redirection. It needs two additional?RewriteCond to make it work. The standard Apache .htaccess code is: <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^(.*)$ https://domainnew.com/$1 [R=301,L] </IfModule> But this will cause all pages to be 404's on the new domain if you are using Litespeed as your server. As an example if you are changing your domain name from domainold.com to domainnew.com and want to redirect each old page to it's new one then you need to only Rewrite the old domain as follows: <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_HOST} ^domainold.com [NC,OR] RewriteCond %{HTTP_HOST} ^www.domainold.com [NC] RewriteRule ^(.*)$ https://domainnew.com/$1 [R=301,L] </IfModule> |
Last Updated on Saturday, 22 January 2022 12:12 |