Web Hosting Talk







View Full Version : Making Folder Links


BGnM2000
12-18-2003, 07:08 PM
Does anyone know how I can setup a folder on my server so when some accesses http://www.mysite.com/folder_1/folder_5 it will bring them to http://www.mysite.com/folder_2 for example? Any help would be much appreciated.

Regards,
Elliot

MikeM
12-18-2003, 07:35 PM
htaccess uses redirect to look for any request for a specific page (or a non-specific location, though this can cause infinite loops) and if it finds that request, it forwards it to a new page you have specified:

Redirect /olddirectory/oldfile.html http://yoursite.com/newdirectory/newfile.html


Note that there are 3 parts to that, which should all be on one line : the Redirect command, the location of the file/directory you want redirected relative to the root of your site (/olddirectory/oldfile.html = yoursite.com/olddirectory/oldfile.html) and the full URL of the location you want that request sent to. Each of the 3 is separated by a single space, but all on one line. You can also redirect an entire directory by simple using Redirect /olddirectory http://yoursite.com/newdirectory/

Using this method, you can redirect any number of pages no matter what you do to your directory structure. It is the fastest method that is a global affect.

Sizzly
12-19-2003, 12:12 AM
lots of different methods here. htaccess is probably one of the best.

you can have a php script without an extension to make it appear like a folder. you would then configure your webserver to php parse the file, probably through htaccess

the following two require that you actually create a mysite.com/folder_1/folder_5 and put a file in there which tells the browser to redirect

you can use a php script which sends
header("Location: http://www.mysite.com/folder_2")
call this index.php if your server is configured to show index.php when the directory alone is called.

you can use a plain html page with a <meta refresh> type of tag.