[ACCEPTED]-Remove www site-wide, force https on certain directories and http on the rest?-no-www
Try these rules:
# remove www from host
RewriteCond %{HTTP_HOST} ^www\.(.+)
RewriteCond %{HTTPS}s/%1 ^(on(s)|offs)/(.+)
RewriteRule ^ http%2://%3%{REQUEST_URI} [L,R=301]
# force HTTPS
RewriteCond %{HTTPS} =off
RewriteRule ^(login|foo|bar|…)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# force HTTP
RewriteCond %{HTTPS} =on
RewriteRule !^(login|foo|bar|…)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
You also might want to add 3 some additional conditions to only change 2 the protocol on GET and HEAD requests but 1 not on POST requests.
This code works for me:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
</IfModule>
0
remove www (tested):
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_HOST} ^www\.yoursite\.com$ [NC]
RewriteRule ^(.*)$ http://yoursite.com/$1 [L,R=301]
redirect (not tested):
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{THE_REQUEST} \/login/?.*\ HTTP [NC]
RewriteRule ^(.*)$ https://yoursite.com/login [L,R=301]
0
After reading this all post time line i 19 have get success for following error: My 18 website(c4dprime.com) was attached https: in 17 mozilla firefox browser. Google and internet 16 explore are show domain address as http: (The 15 real problem in firefox) I did not want 14 https: for my domain in any browser because 13 one unknow redirect attached with my domain 12 by https: (Cause for this error)after Installing 11 following plugins in wordpress,(Easy redirect 10 for ssl).... I have told to every one do 9 not use any low level plugins for wordpress.
Anyway! After 8 reading many articles and tutorials at this 7 topic via google search engine. Now i am 6 happy to say i have solve this problem from 5 this post tips. Remember one thing about 4 me i am new to in this form and wordpress.
This 3 tip is help full for me
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_HOST} ^www\.yoursite\.com$ [NC]
RewriteRule ^(.*)$ http://yoursite.com/$1 [L,R=301]
After edit or some 2 changes in my .htaccess file following code 1 i have use now with solved this error.
AddHandler c4d-prime .com
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteBase /
RewriteRule ^$ http://www.c4dprime.com/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.