|
|
Subject:
Apache mod_rewrite RewriteRule
Category: Computers > Internet Asked by: mikestuff-ga List Price: $50.00 |
Posted:
08 Jul 2005 06:39 PDT
Expires: 07 Aug 2005 06:39 PDT Question ID: 541229 |
I am currently using the following Apache directive to rewrite the url RewriteRule ^/content(.*).html$ /contentmgr/showdetails.php?id=$1 [L] http://www.anysite.com/content1234.html to /contentmgr/showdetails.php?id=1234 This works great until the url has parameters like the following: http://www.anysite.com/content1234.html?a=1&b=2&c=3 In this case, the rewrite rule doesn't work. Please provide a RewriteRule that will work for both type of urls So http://www.anysite.com/content1234.html is rewritten as /contentmgr/showdetails.php?id=1234 and http://www.anysite.com/content1234.html?a=1&b=2&c=3 is rewritten as /contentmgr/showdetails.php?id=1234&a=1&b=2&c=3 TIA! |
|
There is no answer at this time. |
|
Subject:
Re: Apache mod_rewrite RewriteRule
From: vladimir-ga on 10 Jul 2005 14:14 PDT |
Try using the following two rules (the second one is the one you wrote with a backslash added to escape the dot). Together they should do the trick. RewriteRule ^/content(.*)\.html\?(.*)$ /contentmgr/showdetails.php?id=$1&$2 [L] RewriteRule ^/content(.*)\.html$ /contentmgr/showdetails.php?id=$1 [L] |
Subject:
Re: Apache mod_rewrite RewriteRule
From: mikestuff-ga on 11 Jul 2005 05:40 PDT |
Thanks. I forgot to slash out the dot. The new rule you wrote doesn't work. I had done something similar, but it didn't work either. hmmmmm. The second rewrite rule works fine. I looked over the apache config and didn't see anything out of the ordinary. I also commented out all RewriteRules except the new one you sent and it still made no difference. I am running Apache 2.0.46. I am not sure if that would make any difference. Any ideas? Thanks again... |
Subject:
Re: Apache mod_rewrite RewriteRule
From: vladimir-ga on 11 Jul 2005 07:35 PDT |
Yeah, I'm sorry for posting that without checking first. I'm pretty sure this should work though: RewriteRule ^/content(.*)\.html$ /contentmgr/showdetails.php?id=$1 [QSA,L] Notice the "QSA", it means that the stuff after "?" on the right gets added to the query string. Without it the query string is replaced. Please check if this works for you and sorry for the confusion. |
Subject:
Re: Apache mod_rewrite RewriteRule
From: mikestuff-ga on 11 Jul 2005 09:01 PDT |
Excellent! That works perfectly! |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |