Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

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]
share|improve this answer
    
Perfect, thanks! –  Wryan Aug 8 '11 at 16:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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