Redirect based on query string value
2 posts
• Page 1 of 1
Redirect based on query string value
Hi,
I would like to create a redirect based on a query string value of "page=19304" or "page=832".
For example, would like to redirect http://www.domain.org.uk?page=19304 or http://www.domain.org.uk/test/news.aspx?page=19304 to another page like http://www.domain.org.uk/help.aspx
I have created and tested the following regular expression on a development machine and seems to work:
RewriteCond %{HTTP_HOST} ^(?:www\.)domain\.org\.uk$ [NC]
RewriteCond %{QUERY_STRING} ^page=19304$ [NC]
RewriteRule .* http://www.domain.org.uk/help.aspx [NC,R=301,L]
I was wondering if anyone could see any errors or suggestions to improve this regular expression?
Thanks
I would like to create a redirect based on a query string value of "page=19304" or "page=832".
For example, would like to redirect http://www.domain.org.uk?page=19304 or http://www.domain.org.uk/test/news.aspx?page=19304 to another page like http://www.domain.org.uk/help.aspx
I have created and tested the following regular expression on a development machine and seems to work:
RewriteCond %{HTTP_HOST} ^(?:www\.)domain\.org\.uk$ [NC]
RewriteCond %{QUERY_STRING} ^page=19304$ [NC]
RewriteRule .* http://www.domain.org.uk/help.aspx [NC,R=301,L]
I was wondering if anyone could see any errors or suggestions to improve this regular expression?
Thanks
Re: Redirect based on query string value
Hello,
Your rules look absolutely fine. But here are some tiny fixes:
RewriteCond %{HTTP_HOST} ^(?:www\.)?domain\.org\.uk$ [NC]
RewriteCond %{QUERY_STRING} ^page=19304$ [NC]
RewriteRule .? http://www.domain.org.uk/help.aspx? [NC,R=301,L]
Your rules look absolutely fine. But here are some tiny fixes:
RewriteCond %{HTTP_HOST} ^(?:www\.)?domain\.org\.uk$ [NC]
RewriteCond %{QUERY_STRING} ^page=19304$ [NC]
RewriteRule .? http://www.domain.org.uk/help.aspx? [NC,R=301,L]
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 13 guests