Redirects and Hard Links
I am missing something...
I am trying to create a redirect so that if a user enters www.originaldomain.com and originaldomain.com to go to newdomain.com.
However, if anything at all is typed after originaldomain.com, such as originaldomain.com/other folder... I get a not found error.
I am NOT looking for wildcard... so no, I am not looking to send originaldomain.com/something to newdomain.com/something.
I want originaldomain.com/something, originaldomain.com/otherstuff, originaldomain.com/folder/file.html and anything else to all go to the root of the forwarded domain, newdomain.com.
This is not happening, and I had been taking for granted this was standard for a "hard link" forward.
So... what am I missing?
-
Hello, Can you let us know the specific rewrite rules you are using in the .htaccess file within the document root of the original domain name? It's likely you will need to update the Mod_Rewrite rules for your specific criteria. StackOverflow is a useful resource for help with custom rewrite rules. Try entering the "Mod_Rewrite .htaccess redirect all files to new domain name site:stackoverflow.com" as a search term on Google and you should see several results with examples to test. Thank you. 0 -
This is the current .htaccess file: RewriteEngine on # #RewriteEngine on #RewriteOptions inherit #RewriteCond %{HTTP_HOST} ^domain.com$ [OR] #RewriteCond %{HTTP_HOST} ^www\.domain\-t\.com$ #RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$ #RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ #RewriteRule ^/?$ "https\:\/\/newdomain\.co\/" [R=301,L] RewriteCond %{HTTP_HOST} ^domain\.com$ [OR] RewriteCond %{HTTP_HOST} ^www\.domain\.com$ RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$ RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ RewriteRule ^/?$ "https\:\/\/newdomain\.co\/index\.php\/en\/" [R=301,L] Yes, I was thinking something to do with Mod_Rewrite as well. I'll do as you suggest and research the above... we should be able to solve from there. Thanks, 0 -
OK... so the .htaccess should look like: RewriteEngine on RewriteRule ^(.*)$ https: //newdomain.com/$1 [R=301] (space added to URL above to allow it to show) I changed it to that and all works as expected now. So yes, I probably need to make adjustments to the Mod_Rewrite. Will do so. Thanks. 0
Please sign in to leave a comment.
Comments
3 comments