I am changing my development structure to have rewrite urls for fuse/action and I thought it’s cool if I represent all URLs like google ( http://www.google.co.in/search?hl=en&client=firefox-a)
so http://mysite.com?index.php?action=search&q=vikrant should look like
http://mysite.com/search?q=vikrant
for this purpose I have first tried a simple rule to match anything after “/”.
RewriteEngine On
RewriteRule ^(.*)$ index.php?action=$1 [L]
but when I print GET variables then it s only giving me the part before “?” (that was strange)
Then after googling a bit I just got the hint that Mod Rewrite do not matches string after “?” because it’s treating it as %{QUERYSTRING} , hence I have created following rule to achieve the result which is running perfect for me
RewriteEngine On RewriteRule ^/?([^/][^\./]*)[:;,\.]*$ index.php?action=$1&%{QUERY_STRING} [L]
Post originally taken from http://vikrant_labde.blogspot.in/
This entry was posted in Web on July 18, 2012 by vikrant labde.
QueryString in .htaccess – Match Question Mark in rewrite rule | Cuelogic Blog
I am changing my development structure to have rewrite urls for fuse/action and I thought it’s cool if I represent all URLs like google (
http://www.google.co.in/search?hl=en&client=firefox-a)so
http://mysite.com?index.php?action=search&q=vikrantshould look likehttp://mysite.com/search?q=vikrantfor this purpose I have first tried a simple rule to match anything after “/”.
RewriteEngine OnRewriteRule ^(.*)$ index.php?action=$1 [L]but when I print GET variables then it s only giving me the part before “?” (that was strange)
Then after googling a bit I just got the hint that Mod Rewrite do not matches string after “?” because it’s treating it as
%{QUERYSTRING}, hence I have created following rule to achieve the result which is running perfect for meRewriteEngine On RewriteRule ^/?([^/][^\./]*)[:;,\.]*$ index.php?action=$1&%{QUERY_STRING} [L]Post originally taken from http://vikrant_labde.blogspot.in/
This entry was posted in Web on July 18, 2012 by vikrant labde.