.htaccess - Force HTTP for non WWW and WWW -


i'm trying force users http, don't want people access our site https. code below redirects http fine visits site https://www not https://website

rewriteengine on rewritecond %{https} on rewriterule (.*) http://%{http_host}%{request_uri} [r=301,l] 

how make same thing when people enter url without www? site being forced www though wordpress.

thanks!

rewriteengine on rewritecond %{https} ^on rewritecond %{http_host} ^(www\.)?(.+) rewriterule (.*) http://%{http_host}%{request_uri} [r=301,l]   ## expires caching ## <ifmodule mod_expires.c> expiresactive on expiresbytype image/jpg "access 1 year" expiresbytype image/jpeg "access 1 year" expiresbytype image/gif "access 1 year" expiresbytype image/png "access 1 year" expiresbytype text/css "access 1 month" expiresbytype text/html "access 1 month" expiresbytype application/pdf "access 1 month" expiresbytype text/x-javascript "access 1 month" expiresbytype application/x-shockwave-flash "access 1 month" expiresbytype image/x-icon "access 1 year" expiresdefault "access 1 month" </ifmodule> ## expires caching ##   # begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] </ifmodule> # end wordpress  # gzip ninja speed -- starts here # not write between "gzip ninja speed -- starts" , "gzip ninja speed -- ends" # deleted while uninstalling gzip ninja speed plugin addoutputfilterbytype deflate text/plain #gzip ninja speed addoutputfilterbytype deflate text/html #gzip ninja speed addoutputfilterbytype deflate text/xml #gzip ninja speed addoutputfilterbytype deflate text/css #gzip ninja speed addoutputfilterbytype deflate application/xml #gzip ninja speed addoutputfilterbytype deflate application/xhtml+xml #gzip ninja speed addoutputfilterbytype deflate application/rss+xml #gzip ninja speed addoutputfilterbytype deflate application/javascript #gzip ninja speed addoutputfilterbytype deflate application/x-javascript #gzip ninja speed addtype x-font/otf .otf #gzip ninja speed addtype x-font/ttf .ttf #gzip ninja speed addtype x-font/eot .eot #gzip ninja speed addtype x-font/woff .woff #gzip ninja speed addtype image/x-icon .ico #gzip ninja speed addtype image/png .png #gzip ninja speed # gzip ninja speed -- ends here 

you can use in .htacess

rewritecond %{https} ^on rewritecond %{http_host} ^(www\.)?(.+) rewriterule (.*) http://%{http_host}%{request_uri} [r=301,l] 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -