Greenguy's Board


Go Back   Greenguy's Board > General Business Knowledge
Register FAQ Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 03-01-2021, 01:56 PM   #1
Ramster
Life is good
 
Ramster's Avatar
 
Join Date: Apr 2003
Location: Ottawa, Canada
Posts: 10,706
Send a message via ICQ to Ramster Send a message via AIM to Ramster
301 Redirect

Trying to redirect everything that comes into a folder, problem is it's often subfolders within it. Any ideas?

.htaccess:
RewriteRule ^/(.*)$ https://domain.com/site/$1 [L,R=301]

Placing it in domain.com/site/scene/ folder so when someone lands on domain.com/site/scene/757/1922/her-video they get redirected to just https://domain.com/site/

Anyone?
__________________
Pornstar Legends | Hot Babes 4K | Hungarian Girls
Skype: robmurray999
Ramster is offline   Reply With Quote
Old 03-10-2021, 11:22 PM   #2
sarettah
They have the Internet on computers, now?
 
Join Date: Apr 2005
Posts: 140
Quote:
Originally Posted by Ramster View Post
Trying to redirect everything that comes into a folder, problem is it's often subfolders within it. Any ideas?

.htaccess:
RewriteRule ^/(.*)$ https://domain.com/site/$1 [L,R=301]

Placing it in domain.com/site/scene/ folder so when someone lands on domain.com/site/scene/757/1922/her-video they get redirected to just https://domain.com/site/

Anyone?
If you do not have any additional .htaccess files in the subfolders then that should work I would think. If it encounters another .htaccess along the way that will override, I believe.

I will test for a second and let you know.

Last edited by sarettah; 03-10-2021 at 11:52 PM..
sarettah is offline   Reply With Quote
Old 03-10-2021, 11:48 PM   #3
sarettah
They have the Internet on computers, now?
 
Join Date: Apr 2005
Posts: 140
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
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:24 PM.


Mark Read
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Greenguy Marketing Inc