View Single Post
Old 31st May 2008, 04:19 PM   #1 (permalink)
pjrobertson
Registered User
 
Join Date: Jun 2007
Location: Wales, UK
Posts: 37
exclude certain files from .htaccess redirect

Well, I've just moved all my files from .html to .php but most search engines still point to the html files.

I've made a .htaccess file with this in:

Code:
Options +FollowSymLinks
RewriteEngine On
RedirectMatch 301 (.*)\.html$ $1.php
ErrorDocument 404 http://example.co.uk/error_docs/404.html
Which works, except I have some pages (as you can see, 1 is the 404 page) that need to stay as html. Some others are the googlesitemap validation file.

I've looked at

RewriteCond %{REQUEST_URI} !^/error_docs$


but I can't seem to get it to work. What's the best way of excluding files

the files I have are:

/error_docs/404.html
google466e821b876059fa.html

and a few folders such as
/design/
/scripts/

and a few others.

So as not to make a new topic: a few other things.

the 404 redirect:

sites like amazon.co.uk DON'T redirect the user to a new page if they get a 404

e.g. if you go to http://amazon.co.uk/adkfhkh
the error show up on that page as opposed to being sent to amazon.co.uk/custom404page.html

is there a way of doing this?

The final thing:

I recently updated the diary / blog on the site to wordpress (from 100% manual!)
so I have pages like
nov07.html
dec07.html
etc. that I want to redirect to /diary/

is there a way of doing this?

I've tried

Code:
RedirectMatch 301 (.*)07\.html$ /diary
thanks

Last edited by pjrobertson : 2nd June 2008 at 04:27 PM.
pjrobertson is offline   Reply With Quote