View Full Version : redirect from Query String to static page

10-04-2011, 01:29 AM
I am trying to create a rule that will permanently redirect the url


to this url


Can someone please help me? this is what I have come up with so far, but it results in an internal error.

RewriteCond %{QUERY_STRING} ^?C17.106$
RewriteRule ^/home.php$ http://rvahc.jtrvm.servertrust.com/category-s/42.htm [L,R=301]

thank you

10-04-2011, 02:44 PM
I assume you have RewriteEngine On somewhere in the file too? The QUERY_STRING variable doesn't contain the question mark so drop that from the RewriteCond. If you are placing these directives in a .htaccess file, then also remove the forward slash from the /home part in your RewriteRule (if you are placing it in the VirtualHost however, it should be there). You should probably escape the dot in the RewriteCond by adding a forward slash to the start of it. Other than that you should be good to go.

If you still get the 500 server error then perhaps mod_rewrite isn't enabled. You can check by wrapping your rewrite directives in an IfModule block,

<IfModule mod_rewrite.c>
# your code here

It won't make it work, but if it stops your server from crashing then you know mod_rewrite isn't enabled.

On a side note, I generally find that it's best, when working with rewrites, to always use 302 status code. Once you are happy everything works OK, you can change it to a 301, but testing with a 301 is a pain because your local DNS / browser can cache the redirect meaning you may not be seeing what your current code is really doing.

10-04-2011, 04:30 PM
great, that worked perfectly. thank you.