Home Redirect https://example.com to https://www.example.com htaccess
Reply: 0

Redirect https://example.com to https://www.example.com htaccess

Osian Jones
Osian Jones Published in 2018-02-13 12:33:34Z

I have a htaccess file which redirects

RewriteEngine On

RewriteCond %{HTTPS} off [OR]

RewriteCond %{HTTP_HOST} !^www\. [NC]

RewriteRule (.*) https://www.example.co.uk%{REQUEST_URI} [R=301,L]

This redirects everything to https://www.example.co.uk fine. But if i take the www. away so it's https://example.co.uk it opens that page without the www.

Has anybody encountered this and found a way around it so that everything redirects to the desired url? I'm only doing it as ahrefs and search console crawlers are seeing some of the things as duplicate content.

Thanks in advance for any feedback.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.242983 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO