Enforce domain.com/sub to sub.domain.com

webunity

Verified User
Joined
Sep 23, 2014
Messages
49
Hi,

Problem 1: I would like to have an SSL cert on "sub.domain.com", and not on "www.domain.com"
Solution 1: I've ordered a SSL cert for "sub.domain.com" and installed it via DA to "www.domain.com" (and i will access https://sub.domain.com/) the site is not yet migrated but this would work, right?

Problem 2: I don't want people to be able to access http://www.domain.com/sub/
Not only because i find it but ugly, but also because that would expose the "should be" SSL protected files over http.

So, is there some sort of option i can set in DA to enforce this?
Should/can i put the domain in a different folder while still be able to protect it with SSL?

(or)

Should i add an .htaccess file which redirects all www traffic? What is the best option if I don't want the customer with DA "user" access to remove my settings?
- Redirect all traffic, coming from (*)://www.domain.com/sub/ to https://sub.domain.com/
- Redirect all traffic, coming from http://sub.domain.com/ to https://sub.domain.com/
Sound like a script request i know, but try to put that above .htaccess request into google :)
 
Use .htaccess in domains/example.com/public_html/sub folder to rewrite it to https://sub.example.com/.

Be sure to put all the code for sub.example.com in domains/example.com/private_html/sub and NOT into domains/example.com/public_html/sub.

As root, chattr the .htaccess file in domains/example.com/pub/.htaccess as immutable.

Remember you've done it because you won't be able to ever delete the user until you've chattr'd it back as mutable.

Jeff
 
Problem 1: I would like to have an SSL cert on "sub.domain.com", and not on "www.domain.com"

Unless you are going to have a wildcard SSL cert you should better add sub.domain.com as a regular domain with its own public_html and private_html folders. If you're not going to use wildcard SSL cert then you'll get domain mismatch warnings about SSL when visiting https://www.domain.com/sub/ even before redirect does its job.
 
Back
Top