Jump to content

Prevent users from accessing subdomains from directory


Recommended Posts

Posted

Hi, so currently people are able to do "<mydomain>.com/admin" and "admin.<mydomain>.com".

 

I want them to only be able to do "admin.<mydomain>.com". Is this possible to do? My addon domain is located in "public_html/<mydomain>"

Posted

Edit your .htaccess and try this

RewriteEngine On
RewriteCond %{HTTP_HOST} !admin.mydomain.com$ [NC]
RewriteRule ^/admin/(.*)$ https://admin.mydomain.com/$1 [R=301,L]

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...