I'm currently going back into an old domain and creating redirects for SEO purposes. I haven't done this much so I'm learning as I go along.

I'm trying to:

  • have some pages 301 directly to equivalent pages on the new site (done)
  • have one single page not redirect at all (need help)
  • have all other pages redirect to the new homepage (done)

So far I have:

RedirectMatch 301 contactinfo.html http://www.newdomain.com/contact.php
RedirectMatch 301 (.).html http://www.newdomain.com/index.php 

How can I disallow the redirection of a single page?

link|improve this question
feedback

1 Answer

up vote 2 down vote accepted

The Redirect directives don't really have the flexibility to do this. Try using mod_rewrite:

RewriteEngine on
# Equivalent to your first RedirectMatch
RewriteRule ^contactinfo\.html$ http://www.newdomain.com/contact.php [R=301,L]
# Avoids taking any action on this page.
RewriteRule ^filetonotredirect\.html$ - [L]
# Equivalent to your second RedirectMatch
RewriteRule ^.*\.html$ http://www.newdomain.com/index.php [R=301,L]
link|improve this answer
Perfect, thanks! – Wryan Aug 8 '11 at 16:40
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.