Thread: 301 Redirect
View Single Post
Old 03-10-2021, 11:48 PM   #3
sarettah
The only guys who wear Hawaiian shirts are gay guys and big fat party animals
 
Join Date: Apr 2005
Posts: 170
I set up a test at https://madspiders.com/htaccess_test/

In the root directory I have just an index.htm page that will show "Main Page".

I have a subfolder called subfolder1. in there is an .htaccess file that looks like this:

RewriteEngine On
RewriteRule ^(.*)$ ../

In there is also another index.htm page that if it gets hit will show "subfolder1"

So anything hitting there should be redirected to the main folder one step down. And it does that. https://madspiders.com/htaccess_test/subfolder1/

Inside of subfolder1 I have a subfolder called subfolder2. That has an index.htm page that will show "subfolder 2" if it gets hit. There is no .htaccess file in subfolder2.

So the .htaccess folder in subfolder1 controls the rules and subfolder2 never shows because the hit is redirected to the Main folder.

https://madspiders.com/htaccess_test...r1/subfolder2/

Inside subfolder2 I have a subfolder called (can you guess?, yeppir), subfolder3. That has an index page that when it gets hit will show subfolder 3. It also has an .htaccess file with just one line RewriteEngine Off

That turns off the redirect at that level and lets you see subfolder3.

https://madspiders.com/htaccess_test...r2/subfolder3/


So, like I say, you should be able to do the redirect of everything subfolders and all with just 1 htaccess file at the proper level.

Hope that helps and I hope it answered the question, lol. Hate to type that much and find out I misinterpreted the question.

.

Last edited by sarettah; 03-10-2021 at 11:51 PM..
sarettah is offline   Reply With Quote