Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Need Help with .htaccess and folder to subdomain redirect

Discussion in 'General Discussion' started by bpat1434, May 25, 2008.

  1. bpat1434

    bpat1434 Well-Known Member

    Joined:
    Oct 2, 2004
    Messages:
    71
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    Columbia, MD
    I've got an SSL cert set up for a sub-domain and I'd like to (1) deny users the ability to reach the subdomain without SSL and (2) not allow users to reach the folder via: domain.tld/sub.

    cPanel by default creates subdomains in a folder in the document root. I'd like to disable people from reaching the subdomain via the "/subdomain" folder link, so I've set up my .htaccess like so:

    Code:
    RewriteEngine On
    
    # If they're not using SSL, force them to use it.
    RewriteCond %{HTTPS} !=on
    RewriteRule .* https://manager.domain.com [R,L]
    
    # If they're reaching the page via: domain.com/manager,
    # make them use manager.domain.com
    RewriteCond %{HTTP_HOST} !^manager\.domain\.com$ [NC]
    RewriteRule ^.* https://manager.domain.com [R,L]
    Now this gives me an infinite loop issue. Is there another solution to my problem?
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice