DevCompany
DevCompany

Reputation: 699

How to not redirect a single folder on a website....in htacess

I have my website in a subfolder from the main root.

www.domain.com ---redirects to---> www.domain.com/Folder1/

using:

RewriteEngine on
RewriteCond %{SERVER_NAME} domain.com [OR]
RewriteCond %{SERVER_NAME} www.domain.com
RewriteRule ^(.*)$ http://www.domain.com/Folder1/ [R=301]

this is working fine... I also have a administrative WebApp located on Folder2. Folder2 users will always enter the direct URL to Folder2.

http://www.domain.com/Folder2/Version1/

It is at the same structure level as Folder1.

Problem is that when I try to access my webapp, its not working anymore and redirecting it to the Folder1 website.

Question: What htaccess code do I need to add to keep my webapp (folder2) working by not redirecting it to Folder1, while still making all regular users go to Folder1.

Customer facing Website: www.domain.com/Folder1/

Internal Admin Website: www.domain.com/Folder2/Version1/

Upvotes: 1

Views: 1080

Answers (1)

Ahmed Masud
Ahmed Masud

Reputation: 22422

In Folder2 you should add the following line to .htaccess

RewriteRule .* - [L]

This rewrite rule takes precedence over the .htaccess in the parent directory.

Upvotes: 2

Related Questions