I have a domain like "360research.pchealth.ca", where if user hits "360research.pchealth.ca/admin", system will go into ADMIN folder, but what I need that if user hit "360research.pchealth.ca" it goes to ADMIN but don't show in URL that user is in ADMIN folder.
1 Answer
Put this in the htaccess file in your document root:
RewriteEngine On
RewriteCond %{HTTP_HOST} 360research\.pchealth\.ca [NC]
RewriteCond %{REQUEST_URI} !^/admin/
RewriteRule ^(.*)$ /admin/$1 [L]
4 Comments
Umer
Is it fine if I need to trail: RewriteCond %{HTTP_HOST} 360research\.pchealth\.ca/system/research/canadian/ [NC]
Jon Lin
@Umer
/system/research/canadian/ isn't part of the HOST, so that condition will always fail.Umer
Just a Q: What if I have "admin" directory exit under 360research.pchealth.ca/system/research/canadian/admin and now wants 360research.pchealth.ca/system/research/canadian/ to read in 360research.pchealth.ca/system/research/canadian/admin/
Jon Lin
@Umer then replace the
RewriteRule ^(.*)$ /admin/$1 [L] rule with RewriteRule ^system/research/canadian/(.*)$ /system/research/canadian/admin/$1 [L] and the condition to RewriteCond %{REQUEST_URI} !^/system/research/canadian/admin/