404's and Dead pages after 301 redirect

Discussion in 'Apache' started by Mindfix, Mar 14, 2006.

  1. #1
    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
     
    Mindfix, Mar 14, 2006 IP
  2. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #2
    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.
     
    Nintendo, Mar 14, 2006 IP
  3. Mindfix

    Mindfix Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    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
     
    Mindfix, Mar 19, 2006 IP
  4. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #4
    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.
     
    Nintendo, Mar 20, 2006 IP