We recently did a 301 permanent on a URL: www.san-diego-breast-lift.com, which now takes it to the main site of: http://www.globallasercosmetics.com/ What I am wondering is, is there anyway with Apache to still have a 404 show for that URL? That is, links that exist on the web to say: http://www.san-diego-breast-lift.com/privacy_policy.php4 simply go to dead pages. In httpd.conf we tried making the 404 path absolute to the folder of the 301 path but that does not do it. Is there perhaps an .htaccess rewrite that would redirect the browser on entry to the new URL? Or would we have to individually rewrite each of those page names to a path in an .htaccess file? We tried just doing a simple: RedirectMatch /privacy_policy.php4 http://www.globallasercosmetics.com/index.php4 and that will not work. Is there any way around this? Many thanks in advance. Team
Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^([^.]+)$ http://www.globallasercosmetics.com/$1 [R=301,L] RewriteRule ^privacy_policy\.php4$ http://www.globallasercosmetics.com/index.php4 [R=301,L] Only use one of the last two lines, depending on if it's all files on the domain, or just one.
hmm, that does not seem to work, still if you go to http://www.san-diego-breast-lift.com/privacy_policy.php4 you get a dead page here's how the .htaccess looks now: Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} . RewriteCond %{HTTP_HOST} !^www\.globallasercosmetics\.com [NC] RewriteRule (.*) http://www.globallasercosmetics.com/$1 [R=301,L] RewriteRule ^privacy_policy\.php4$ http://www.globallasercosmetics.com/index.php4 [R=301,L] There was one existing rule to point a non www to a www. but again, in the Apache httpd.conf, for the san-diego-breast-lift.com is a 301 permanant redirect to http://www.globallasercosmetics.com Any other ideas? MF
You get an error because it goes to http://www.globallasercosmetics.comprivacy_policy.php4/ While http://www.globallasercosmetics.com/privacy_policy.php4/ redirects to http://www.globallasercosmetics.com/index.php4 I think RewriteCond %{HTTP_HOST} !^www\.globallasercosmetics\.com [NC] has to be changed if you want that code to work on san-diego-breast-lift.com or try it with out the RewriteCond %{HTTP_HOST} . RewriteCond %{HTTP_HOST} !^www\.globallasercosmetics\.com [NC] then it should redirect.