PDA

View Full Version : URL Rewrite



evikjames
November 9th, 2012, 08:53 AM
I am having trouble getting a rewrite rule to work. I have other rules that are working just fine, but I can't seem to get the simplest of rules to work.

This rule:

RewriteRule \?BikeID=(\d+) /redirect/redirect.cfm [NS,L]

Should push this request

I want this link http://flyingpiston2012-com.securec37.ezhostingserver.com/?bikeid=2069

To this URL

http://flyingpiston2012-com.securec37.ezhostingserver.com//redirect/redirect.cfm

But it doesn't. I have tried everything imaginable. How should I modify this rule?

CalebC
November 9th, 2012, 10:12 AM
Evik,

We updated your permissions to allow for isapi_rewrite rules to work correctly for your domain.
But in regards with the rules you have set you will need to include [QSA] for any rule regarding an ID that is queried.

If you run into further issues with your rewrite rules you will need to submit a support ticket (http://support.hostek.com).

evikjames
November 9th, 2012, 10:52 AM
Evik,

We updated your permissions to allow for isapi_rewrite rules to work correctly for your domain.
But in regards with the rules you have set you will need to include [QSA] for any rule regarding an ID that is queried.

If you run into further issues with your rewrite rules you will need to submit a support ticket (http://support.hostek.com).

Most of the rules were already working correctly, so some level of permission already existed.

It seems that nothing has changed. Everything that was working is still working. Everything that was NOT working, is still NOT working.

You didn't answer the question as to why one rule wasn't working. Is there a reason you didn't answer this question or address it?

evikjames
November 9th, 2012, 10:56 AM
I am trying to write a rewrite rule so that any URL with a BikeID will get redirected to a specific page. I have this as the first rule on the page. The other rules I have are working just fine.

Here is my rule:

RewriteEngine on
RewriteRule ^bikeid* /redirect/redirect.cfm [NC,NS,L]

This rule works for this URL

http://flyingpiston2012-com.securec37.ezhostingserver.com/bikeid=2069

This rule does NOT work for this URL

http://flyingpiston2012-com.securec37.ezhostingserver.com/?bikeid=2069
Other rules that I have tried that do not work are as follows:

RewriteRule ^bikeid* /redirect/redirect.cfm [NC,NS,L]
RewriteRule ^*bikeid* /redirect/redirect.cfm [NC,NS,L]
RewriteRule *bikeid* /redirect/redirect.cfm [NC,NS,L]
RewriteRule \?*bikeid* /redirect/redirect.cfm [NC,NS,L]
RewriteRule ^\?*bikeid* /redirect/redirect.cfm [NC,NS,L]
RewriteRule ^\?bikeid* /redirect/redirect.cfm [NC,NS,L]

What do I have to put in the rule to match any URL that contains the phrase "bikeid"?

CalebC
November 9th, 2012, 12:49 PM
You do not have anything that will handle a query string.

This will work with your current script but this will happen with all query string request for your domain.

RewriteCond %{QUERY_STRING} .+
RewriteRule (.*) /redirect/redirect.cfm$1? [NC,NS,R=301,L]

We updated and placed this at the bottom of your existing .htaccess file.
Please respond with further issues with your Ticket that you submitted.