Forum Moderators: bakedjake
<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.example.net");
exit();
?>
going to [siteOne.net...] redirects to [siteTwo.net...] instead of [siteTwo.net...]
Is there some way to achieve the redirection with the trailing uri remaining intact and hence going to the page itself?
I'm using Apache 1.3.33 on a debian linux system.
Thanks in advance :)
I tried the following:
RewriteEngine onRewriteCond %{HTTP_HOST}!^subdomain\.domain\.net
RewriteRule (.*)$ http://subdomain.domain.net/$1 [R=301,L]
But the issue was that since this is for a subfolder, it worked when there was a trailing slash or a longer url but failed for the folder name without a trailing slash.
So, "http://subdomain.old-site.net/foldername/" and "http://subdomain.old-site.net/foldername/somefile" both get redirected correctly, "http://subdomain.old-site.net/foldername" did not forward correctly but infact forwarded to the new domain appended with the filesystem path of that directory.
eg. "http://subdomain.new-site.net//home/username/public_html/aj/foldername" which of course is incorrect.
I would prefer to use a 301 redirect so as to maintain my page rank as well as easily allow SEs to locate the new site..