.htaccess - yet another rewriterule issue: adding a parameter to all URI without changing them -
i want rewrite
www.mydomain.com/www/whatever.phpto
www.mydomain.com/www/whatever.php?hl=enwhatever.php not fixed, represents php page in www directory.
my htaccess looks @ moment:
rewriteengine on rewritecond %{request_uri} !hl= rewriterule ^(.+)$ $1?hl=en [qsa,r=301,l]
but reason adds real harddrive path of each page www.mydomain.com, example:
127.0.0.1:8080/index.phpbecomes
127.0.0.1:8080/d:/mypath/index.php?hl=eni must doing wrong here, idea?
you may seek this:
options +followsymlinks rewriteengine on rewritebase / rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond %{request_uri} ^/(www/[^.]+\.php)/? [nc] rewriterule .* %1?h1-en [r=301,l]
redirects permanently
http://www.mydomain.com/www/whatever.php
or without trailing slash
to:
http://www.mydomain.com/www/whatever.php?hl=en
all string assumed fixed, except whatever
.
for silent mapping, replace [r=301,l]
[l]
edit so:
rewriteengine on rewritebase / rewritecond %{query_string} !hl= rewritecond %{request_uri} ^/(www/[^.]+\.php)/? [nc] rewriterule .* %1?hl=en [r=301,l]
did trick, thanks
.htaccess mod-rewrite
No comments:
Post a Comment