Forum Moderators: rogerd & travelin cat
# BEGIN WordPress
<IfModule mod_rewrite.c> block of rewrites? [edited by: phranque at 8:44 am (utc) on Nov 3, 2020]
[edit reason] unlinked "url" [/edit]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !(^www\.example\.com$)? [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L] [edited by: phranque at 8:36 pm (utc) on Nov 3, 2020]
[edited by: phranque at 12:38 pm (utc) on Nov 3, 2020]
[edit reason] unlinked "url" [/edit]
So you are suggesting
I wanted to ask something about the setting up of Siteground.
Discussions On Hosting:
Public discussion and recommendation of hosting companies is not allowed in the Wordpress forum. If you are a subscriber to Webmaster World please see the Webhosting Issues and Options forum. Please be sure to read the forum Charter before posting!
Should I have included it as "www example com"?
#Redirect invalid and www requests
RewriteCond %{HTTP_HOST} !^(example\.com)?$
RewriteRule (.*) https://example.com/$1 [R=301,L]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L] <!-- invisible --> to add notes in html for yourself. The htaccess lines you posted contain several examples such as # BEGIN WordPress AddHandler application/x-httpd-php73 .html .php BUT check with your host because there are proprietary variations to that format.
Then, do I use this?
RewriteCond %{HTTP_HOST} !^(example\.com)?$
RewriteRule (.*) https://example.com/$1 [R=301,L]
Or this?
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} !^(example\.com)?$ [NC,OR]
RewriteCond %{SERVER_PORT} 80
RewriteRule (.*) https://example.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} !^(example\.com)?$ [NC,OR]
RewriteCond %{HTTP_HOST} !^example\.com$ [OR]
[edited by: phranque at 8:46 am (utc) on Nov 4, 2020]
[edit reason] unlinked urls [/edit]
All of them except the last one with the :80 work.We're constantly telling people that “doesn’t work” isn’t specific enough; you have to go into detail about exactly what happens. Here it’s the other way around, but still valid: What, exactly, does “work” mean?
So guys, I had problems with my Cloudflare (wasnt working) so I had to take one step backwards and push the www domain com as the main entity.
what sort of changes I should to at the htaccess now, as when I type the url as "domain com", there is a 301 redirect from "http domain com" to "https domain com" and then another 301 to "https www domain com".
Did you change the URLs in the WP adming Settings > General panel? That needs to be www if you want to skip the extra redirect.
[edited by: phranque at 9:12 am (utc) on Nov 5, 2020]
[edit reason] exemplified domains [/edit]
[edited by: phranque at 10:36 am (utc) on Nov 5, 2020]
[edit reason] unlinked url [/edit]
In order to avoid making any mistake, can you just include the whole code according to message 5015516?
RewriteEngine On RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !(^www\.example\.com$)? [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L] # BEGIN WordPress
...
# END WordPress But if check its details, there is this setting:
cache-control private, max-age=600, stale-while-revalidate=604800
Is this not a Expires header?
use.typekit.net