Skip to main content
13 events
when toggle format what by license comment
Apr 10, 2021 at 16:34 comment added spl I've been on the road for a bit now - my apologies for a very delayed response!! i really appreciate your input on this. i can't quite digest all of this good stuff right now - will update once i've been able to process.
Apr 10, 2021 at 16:26 vote accept spl
Apr 5, 2021 at 17:14 history edited MrWhite CC BY-SA 4.0
Added more notes about the benefits of the 3
Apr 5, 2021 at 17:10 comment added MrWhite @spl The L (last) flag indicates this is the last rule and prevents further processing. You nearly always want to use the L flag with external redirects. If this is already the last rule in the .htaccess file then it's not strictly required, however, it would be good practice to include it since you will need to add it if you add more rules later in the file.
Apr 5, 2021 at 17:02 comment added MrWhite @spl Regarding the 301 redirection... I'm not sure why you didn't use the directive exactly as I've written in my answer, or is that what you already had? You need to backslash escape literal dots in the regex. eg. ^example\.com - otherwise you potentially match too much (the dot matches any character). And you should not use NC instead of L in the last RewriteRule (uppercase by convention). NC (nocase) makes the pattern match case-insensitive, but it's matching everything anyway so this flag is redundant.
Apr 5, 2021 at 16:56 comment added MrWhite @spl "i still do not understand the implications" - I've updated my answer with what duplicate content is and how this can affect your site/rankings. "my XML sitemap only references 'https:'" - yes, but what about www vs non-www? Only the canonical hostname should be in your XML sitemap. If you've not done anything the canonicalise the hostname, then you might not technically have one. Although you probably have a "preferred" hostname and if you have an XML sitemap then you've explicitly included a hostname there.
Apr 5, 2021 at 16:47 history edited MrWhite CC BY-SA 4.0
Added information about what "duplicate content" actually is
Apr 5, 2021 at 15:44 comment added spl I've just checked, and I believe the canonical hostname is https://www.example.com.
Apr 5, 2021 at 14:03 comment added spl On the 301 redirection - here is what I've added within the htaccess file: RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.example.com/$1 [R,L] # and added this to then get from non-www to www RewriteCond %{HTTP_HOST} ^example.com [nc] RewriteRule ^(.*)$ https://www.example.com/$1 [r=301,nc] Based on what you've outlined above, it looks as though my solution is (a) not necessarily correct if not canonical in the first place, and (b). also not correctly written up. I don't quite understand what the L is for in place of the NC?
Apr 5, 2021 at 14:00 comment added spl On the question of whether my canonical hostname uses the www subdomain - i don't know, to be honest? Can i check this (and, is there a location where i should check it?) Is this something to inspect on the webhost system, or within the actual site content?
Apr 5, 2021 at 13:58 comment added spl Regarding the sitemap, my XML sitemap only references 'https:' URLs.
Apr 5, 2021 at 13:58 comment added spl Really appreciate the feedback! i've added in my individual responses just below this. Regarding referencing URL using either the root domain or the www. prefix, i'm using root relative linking? So for example, to get to my profile page the link is href="/profile.html" from anywhere in the website, so that it finds the root. i'll admit that i still do not understand the implications around the search engine optimisation for this - would this then mean that this could be interfered with when it comes to search engines identify the canonical pages?
Apr 5, 2021 at 11:01 history answered MrWhite CC BY-SA 4.0