Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Advertise on LowEndTalk.com
.htaccess redirect help
New on LowEndTalk? Please read our 'Community Rules' by clicking on it in the right menu!

.htaccess redirect help

bikegremlinbikegremlin Member
edited August 2019 in Tutorials

Yes, I've googled, found different solutions/advice, so though to ask here. I thought it is a routine ruleset to be implemented. But posting the question on another forum (WHT) didn't provide any help. Anyway:

For WordPress websites (if that is relevant) I'd like to use .htaccess rules to enforce the following redirections:

1)
Main domain:

All visits to either:
http://www.example.com
http://example.com
https://example.com

should be redirected to:
https://www.example.com

Including any "trailing" stuff, of course, like:
http://www.example.com/about/ to https://www.example.com/about/

2)
Sub-domain (placed on a separate cPanel account if that info is important)

All visits to either:
http://sub.example.com
http://www.sub.example.com

should be redirected to:
https://sub.example.com

Also including any "trailing" path additions.

Mostly harmless™

I/O Gremlin

Comments

Sign In or Register to comment.