.htaccess - Redirect and replace the last character of the url using htaccess -


i've urls ending question mark (e.g. www.example.com/cars?).

this creates problem of duplicate content because:

www.example.com/cars?

www.example.com/cars

furthermore, i'ld replace ? / (again seo purpose, because url of category) obtain like:

www.example.com/cars/

i tried like:

    rewriteengine on     rewritecond %{request_uri} !(.*)/$     rewriterule ^(.*)$ http://example.com/$1/ [l,r=301] 

you can try :

rewriteengine on rewritecond %{the_request} \?\s rewriterule ^(.+)/?$ http://www.example.com/$1/ [l,r=301] 

(sorry can't test here)


Comments