Redirects

e85andyou

New Member
Messages
49
Reaction score
0
Points
0
I just finished redesigning my website and I have a couple directories that no longer exist. There were over 20 files in one of the directories. I was wondering if it is possible to redirect any all links to all fines in this directory to one file in another directory.

Thanks
 

crisp

New Member
Messages
85
Reaction score
0
Points
0
You should have an .htaccess file in your public_html folder, if not, use cpanel to create one, edit it and add something similar to this (ie replace the folder names, url and filename to match your site

Code:
Redirect 301 /old_directory/ http://your_url/new_directory/name_of_file.htm

301 tells any client requesting from that folder that the move is permanent, if it's only temporary, change it to 302

been a while since I did any re-directs but that should work.
 

e85andyou

New Member
Messages
49
Reaction score
0
Points
0
It is not working if i try to access a file in the old directory it is simply doing a wild card redirect.
 

leafypiggy

Manager of Pens and Office Supplies
Staff member
Messages
3,819
Reaction score
163
Points
63
use cpanel to set the redirect.
 

e85andyou

New Member
Messages
49
Reaction score
0
Points
0
cPannel will not redirect any different than the coding above unless I want to spend the next 2 days setting up 300 redirects for each file in the directory.
 

crisp

New Member
Messages
85
Reaction score
0
Points
0
OK, mod_rewrite it is ;)
Code:
RewriteRule ^old_folder(.*)$ /new_folder/filename.htm [L,R=301]
 
Top