I have a folder structure like this
/localhost/parent/
I have an .htaccess residing in
/localhost/parent/
I want to rewrite everything from /localhost/parent/WebContent/ to /localhost/parent/
here is my code
RewriteEngine on
RewriteRule ^$ WebContent/$1
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^WebContent/
RewriteRule ^(.*)$ WebContent/$1
For some reason the first two lines work fine, but the rest doesn’t work. So I am able to redirect only homepage.
Update
RewriteBase /parent/
RewriteEngine on
RewriteRule ^$ WebContent/$1
#RewriteCond %{REQUEST_URI} !WebContent
RewriteRule (.*) /parent/WebContent/$1 [R=301,L,QSA]
Goes into an infinite loop. I just need to avoid that loop now
I used this