Forum Moderators: phranque
RewriteEngine On
### WWW & HTTPS
# ensure www.
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# ensure https
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
### WWW & HTTPS [edited by: phranque at 3:52 am (utc) on Mar 22, 2018]
[edit reason] unlinked urls [/edit]
when I try to implement the following (see code below) into my .htaccess file it doesnt work nothing happens
Keep in mind when I do try the .htaccess method I disable the wordpress htts plugin and revert the Site Address (URL) back to http
.Htaccess
RewriteEngine On
### WWW & HTTPS
# redirect to https://www..example.com if necessary
RewriteCond %{HTTP:X-Forwarded-Proto} http [OR]
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$ [NC,OR]
RewriteCond %{HTTPS} !on
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]
### WWW & HTTPS [edited by: phranque at 6:25 am (utc) on Mar 22, 2018]
RewriteRule ^(.*)$ https://example.com/$1 [L,R=301] should be: RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]
# 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
# Use PHPstable as default
AddHandler application/x-httpd-php-stable .php
<IfModule mod_suphp.c>
suPHP_ConfigPath /opt/phpstable/lib
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
### WWW & HTTPS
# redirect to https://www.example.com if necessary
RewriteCond %{HTTP:X-Forwarded-Proto} http [OR]
RewriteCond %{HTTP_HOST} !^(www\.eample\.com)?$ [NC,OR]
RewriteCond %{HTTPS} !on
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]
### WWW & HTTPS
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
# Use PHPstable as default
AddHandler application/x-httpd-php-stable .php
<IfModule mod_suphp.c>
suPHP_ConfigPath /opt/phpstable/lib
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c> and ends with # END WordPress should be the last lines of any rewrites. RewriteEngine On
### WWW & HTTPS
# redirect to https://www..example.com if necessary
RewriteCond %{HTTP:X-Forwarded-Proto} http [OR]
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$ [NC,OR]
RewriteCond %{HTTPS} !on
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]
### WWW & HTTPS
# 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
# Use PHPstable as default
AddHandler application/x-httpd-php-stable .php
<IfModule mod_suphp.c>
suPHP_ConfigPath /opt/phpstable/lib
</IfModule>
Does it take time to replicate for the changes to take effect?
Does it take time to replicate for the changes to take effect?It should fix itself if you clear the browser cache and force a refresh. If not, take a closer look at the rules. I have no idea why the browser is blathering about cookies, since they presumably don't figure in your RewriteRule. Maybe it's the brower's equivalent of when technical support tells you to turn the machine off and then on again, regardless of whether it could possibly be relevant to the problem.