jeudi 5 janvier 2017

www to non www redirection through .htaccess file

This is the code in my.htaccess file

#force non-www

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(([a-z0-9_]+\.)?example\.com)$ [NC]
RewriteRule .? http://%1%{REQUEST_URI} [R=301,L]

This code redirects www.example.com to example.com

But whenever there is something ahead of the url

Example -

http://ift.tt/2j7uttT

It redirects me to example.com

I want it to become http://ift.tt/2hVzsQJ

Can someone help ?




Aucun commentaire:

Enregistrer un commentaire