2

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 1

1

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]
Sign up to request clarification or add additional context in comments.

4 Comments

Is it fine if I need to trail: RewriteCond %{HTTP_HOST} 360research\.pchealth\.ca/system/research/canadian/ [NC]
@Umer /system/research/canadian/ isn't part of the HOST, so that condition will always fail.
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/
@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/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.