Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Website and Server Administration Forum


You are currently viewing our Website and Server Administration Forum as a guest. Please register to participate.
Login



Closed Thread
I need to redirect an entire directory, the subs and all pages.
Old 04-05-2008, 05:34 PM I need to redirect an entire directory, the subs and all pages.
Defies a Status

Posts: 1,605
Trades: 0
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

Please login or register to view this content. Registration is FREE
colbyt is offline
View Public Profile
 
 
Register now for full access!
Old 04-07-2008, 08:57 AM Re: I need to redirect an entire directory, the subs and all pages.
Novice Talker

Posts: 11
Name: Logan
Trades: 0
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

Please login or register to view this content. Registration is FREE
| Server Security | Hosting Systems
Experienced, Professional & Available 24/7
SSANZ is offline
View Public Profile
 
Old 04-07-2008, 06:58 PM Re: I need to redirect an entire directory, the subs and all pages.
Super Talker

Posts: 144
Trades: 0
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
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
AHelpingHand is offline
View Public Profile
 
Old 04-10-2008, 09:30 AM Re: I need to redirect an entire directory, the subs and all pages.
Defies a Status

Posts: 1,605
Trades: 0
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

Please login or register to view this content. Registration is FREE
colbyt is offline
View Public Profile
 
Old 04-10-2008, 07:44 PM Re: I need to redirect an entire directory, the subs and all pages.
Defies a Status

Posts: 1,605
Trades: 0
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

Please login or register to view this content. Registration is FREE
colbyt is offline
View Public Profile
 
Old 05-21-2010, 06:57 AM Re: I need to redirect an entire directory, the subs and all pages.
Junior Talker

Posts: 1
Trades: 0
Thanks much for your advice - I had scoured the web for a long time and this finally worked for me and saved me having to redirect every single URL south of the directory! Cheers.
alzybob is offline
View Public Profile
 
Closed Thread     « Reply to I need to redirect an entire directory, the subs and all pages.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
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.39932 seconds with 12 queries