Hi guys, sorry for the wrong forum, there isn’t an apache thread.
l’m trying to use htaccess to 301 redirect a bunch of old pages to a newly improved page. – l have a lot of them and l was wondering if there was a cleaner way of doing this?
Another point to mention, l have each URL listed twice, because it doesn’t seem to work because of the trailing slash on the old page – sometimes it’s there for visitors sometimes it’s not.
And about the trailing slash. If using full paths doesn’t fix that then implement this. This will add the trailing slash to your domain and folders among other things.
mod_alias’s Redirect can’t use a regex engine so, no, your suggestion won’t work. I’m not an expert in mod_alias but you can lookup RedirectMatch and it just might be able to help you.
mod_alias, because of the regex engine, is slower but far more powerful (it can look at more than the {REQUEST_URI}) so what you’ve done is close to:
RewriteEngine on
RewriteRule (page1|page2|page3)/? newpage [R=301,L]
… but that’s only after you slap yourself silly for allowing trailing /'s on files (that should be reserved for directories).
If you need more information about mod_rewrite, you might benefit from reading the mod_rewrite tutorial linked in my signature as it contains explanations and sample code. It’s helped may members and should help you, too.