php - Rewrite rules : forgetting a query string in .htaccess -
i have in .htaccess
rewritecond %{query_string} ^(.*)?$ rewriterule ^([0-9a-za-z\-_]+)(/)? index.php?action=view&type=page&page=$1&%1 [l]
but when put in browser:
http://localhost:8888/myapp/test%20doc
the url transformed into:
index.php?action=view&type=page&page=test
why shouldn't get:
index.php?action=view&type=page&page=test%20doc ?
for readability, remove rewritecond
, add qsa (query string append) flag rewriterule
:
rewriterule ^([\w-]+)/? index.php?action=view&type=page&page=$1 [qsa,l]
the url testing (http://localhost:8888/myapp/test%20doc
) doesn't have query string. mean test with:
http://localhost:8888/myapp/test?doc
edit
you're problem has nothing query strings. fact haven't matched space character in character class , intending to. add space character class. should work you:
^([ \w-]+)/?
the \w
shorthand 0-9a-za-z_
Comments
Post a Comment