Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

If I have multiple domains pointing to the same site.

If I have a domain called admin-domain.com

I only want to allow admin-domain.com/admin/

But disallow anything-else.com/admin/


Also this needs to be done with .htaccess

Also there is no actual admin directory, but there are many urls like ...com/admin/products/edit/54 because I am using the CakePHP framework which already uses htaccess for url's like this. I just want to limit admin access to 1 domain.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Edit the .htaccess file in the Cake webroot directory:

RewriteEngine On
RewriteCond %{HTTP_HOST} !=admin-domain.com
RewriteRule ^admin/.*$ - [F]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
share|improve this answer
    
This works thank you, is there a way to allow www.admin-domain.com also? thanks!! –  JD Isaacks Feb 16 '11 at 19:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.