Reply
I need to redirect an entire directory, the subs and all pages.
Old 04-05-2008, 04:34 PM I need to redirect an entire directory, the subs and all pages.
King Spam Talker

Posts: 1,053
I want to change scripts on an older site of mine. Yahoo has 2400 indexed pages. How they managed that I am not sure since there are only a little over 500 entries in the database.

I wanted to take the easy way out and just redirect the entire directory to the new directory so that no matter what page was requested within that directory the redirection to a single page happens.

I use cPanel and is does not seem to allow that. I am not afraid to edit the .htaccess file as long as I know what to put in there.

Is there any way to make this happen?
colbyt is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 04-07-2008, 07:57 AM Re: I need to redirect an entire directory, the subs and all pages.
Novice Talker

Posts: 11
Name: Logan
Ok, so you want to redirect all hits to a single folder to a new URL correct?

Why not use a index PHP redirect via header get or include?

:S
__________________
Server Systems Administration NZ
SSANZ.NET | Server Security | Hosting Systems
Experienced, Professional & Available 24/7
SSANZ is offline
Reply With Quote
View Public Profile
 
Old 04-07-2008, 05:58 PM Re: I need to redirect an entire directory, the subs and all pages.
Super Talker

Posts: 135
This could easily happen even if you have 500 pages in your database if you are using links to show pages differently as order by date, rating, author ...etc

To redirect add those lines to your .htaccess file after changing them with you values:

RewriteEngine on
RewriteBase /
(Required only once so if they are in your .htaccess file don't add them again)

Redirect 301 http://www.oldsite/olddir/ http://www.newsite/newdir/newpage.html
AHelpingHand is offline
Reply With Quote
View Public Profile
 
Old 04-10-2008, 08:30 AM Re: I need to redirect an entire directory, the subs and all pages.
King Spam Talker

Posts: 1,053
Quote:
Originally Posted by AHelpingHand View Post

RewriteEngine on
RewriteBase /

Redirect 301 http://www.oldsite/olddir/ http://www.newsite/newdir/newpage.html


That is the first thing I tried. It does a beautiful job as alway of redirecting all the requests mysite.com/olddir/ when it is the index page requested.

Is does not however refer any requests that include a file name such as mysite/olddir/page.php


Any more suggestions? I need to resolve this.
colbyt is offline
Reply With Quote
View Public Profile
 
Old 04-10-2008, 06:44 PM Re: I need to redirect an entire directory, the subs and all pages.
King Spam Talker

Posts: 1,053
Problem is resolved.

I am going to post a follow-up message to this post because as I continued to search I noticed in was near the top of the google results and other may be looking for the same answer.

I created this redirect using cPanel10 from the control panel. cPanel wrote something wierd to the .htaccess, which I wish I had copied before I changed it.

Once I manually changed the syntax in the .htaccess file to:

Quote:
RedirectMatch permanent /olddirectoryname http://mysite.com/filenameifdesired
Everything worked as it should. Both the directory and any file that is called in that directory are now forwarded as desired.

Having used cPanel many times to set redirects I really can not explain why this happened.
colbyt is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to I need to redirect an entire directory, the subs and all pages.
 

Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.14135 seconds with 13 queries