.htaccess RewriteRule url to new -
bonjour,
i try redirect urls of website example :
www.exemple.net/?p=2
www.exemple.net/index-2.html
www.exemple.net/?p=35 www.exemple.net/index-35.html etc...
so add lines .htacess :
rewritecond %{query_string} ^(?)p=(.*)$ [nc] rewriterule .* /index-%1.html [l,r=301]
but i'm redirected http://www.exemple.net/index-2.html?p=2
my .htaccess :
rewriteengine on rewritecond %{http_host} ^exemple.net$ rewriterule ^(.*) http://www.exemple.net/$1 [qsa,l,r=301] rewritecond %{query_string} ^(?)p=(.*)$ [nc] rewriterule .* /index-%1.html [l,r=301] rewritebase / rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l]
can me please ?
you need add question mark @ end of destination discard query string:
rewriterule .* /index-%1.html? [l,r=301]
alternatively, use qsd
flag:
rewriterule .* /index-%1.html [qsd,l,r=301]
Comments
Post a Comment