Forum Moderators: phranque
The old one's are index2.php + lots of query strings.
I just want to specifiy the string and specify the page.
For example -
index2.php?page=addressable
REDIRECT TO
addressable.html
How would I do this ?
The 'redirect to' page doesn't need to be dynamic based on the string, I'm happy to specify each one individually.
Any help would be greatly appreciated.
E.G.
redirect 301 /portal.php [domain.com...]
redirect 301 /index2.php?page=contact [domain.com...]
The first line works no problem but the second line doesn't. The examples I have found re-write the query string request to the page name contact.htm or html but I want to manually specify the redirect ?page=contact to contact-us.html or maybe ?page=main to index.html. I cannot find an example of this. If I could I wouldn't of made this post.
Any help, again would be grealy appreciated.
[edited by: domble at 1:45 pm (utc) on Feb. 23, 2009]
Your second rule does not work because Redirect cannot see the query string value. You'll need to use RewriteRule instead, with a RewriteCond to test the QUERY_STRING value.
Be aware that if you use RewriteRule you should not use Redirect or RedirectMatch anywhere in the same .htaccess file. That is, you should use RewriteRule for all of your redirects and rewrites.
Don't specify index file filenames as the target URL of any redirect. Use the bare domain name with trailing slash, or else domain name, plus folder name with trailing slash.