Hi,
Is it good practice to redirect URLs to “https://www.domain.com” if just “https://domain.com” is entered?
I have a simple 6 page website and wondered if there’s any benefits or not to redirect to www. ?
Thanks
Hi,
Is it good practice to redirect URLs to “https://www.domain.com” if just “https://domain.com” is entered?
I have a simple 6 page website and wondered if there’s any benefits or not to redirect to www. ?
Thanks
You should redirect one to the other, as having multiple URLs for the same page is not good for SEO. As far as I know, it makes no difference at all whether you choose to use the version with www or without.
Thanks for the reply.
I have tried this, but it is doing a strange redirect of website.com to https://www.website.com/https://website.com
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
I’m trying to redirect all http URLs to https and all non-www to www.
Have a go with this:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.domain\.com
RewriteRule .? http://domain.com%{REQUEST_URI} [R,L]
RewriteCond %{SERVER_PORT} ^80$
RewriteRule .? https://domain.com%{REQUEST_URI} [R,L]
That.
That works, but it doesn’t redirect non-www. to www.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.website\.co.uk
RewriteRule .? http://website.co.uk%{REQUEST_URI} [R,L]
RewriteCond %{SERVER_PORT} ^80$
RewriteRule .? https://website.co.uk%{REQUEST_URI} [R,L]
I tried adding www. but got an error saying there are too many redirects
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.website\.co.uk
RewriteRule .? http://website.co.uk%{REQUEST_URI} [R,L]
RewriteCond %{SERVER_PORT} ^80$
RewriteRule .? https://www.website.co.uk%{REQUEST_URI} [R,L]
Oops! I misread your requirement. I’ll have to look out the code from somewhere. Back soon…
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain\.co\.uk
RewriteRule .? http://www.domain.co.uk%{REQUEST_URI} [R,L]
RewriteCond %{SERVER_PORT} ^80$
RewriteRule .? https://www.domain.co.uk%{REQUEST_URI} [R,L]
Thanks, that worked
Many thanks for your help!
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.