Using the .htaccess file to redirect file requests.

Started by certforumz, May 05, 2010, 09:30:39 PM

Previous topic - Next topic

certforumz

Using the .htaccess file to redirect file requests.

Directions:

.htaccess file can used to redirect users from one site to another.

You require:
FTP access to the website,
.htaccess mod-rewrite engine enabled on the webserver
Ability to chmod the files

1. In the directory you want to redirect, create (or edit if it already exists) the .htaccess file. Note the leading dot which is required.
2. In one complete line, without any additional line feeds, enter the direct command.

The redirect command has the following format:
redirect old-dir/url new-full-url
- Status is optional and may be one of the following:

permanent - (301) resource has moved permanently.
temp - (302). resource has moved temporarily.
seeother - (303) resource has been replaced.
gone - (410) resource has been permanently removed. (When this status is used the new-url argument should not be used.)

3. Save the file
4. Set read permission on the file.
Example:

RewriteEngine On
Redirect /ccna-simulator/sim.html http://routersimulator.certexams.com/ccna-simulator-download/download-network-simulator-designer.html

Note that \"RewriteEngine On\" command is essential.
You can also redirect any other file extensions. Redirection can be made to external domains also.');

http://www.htpasswdgenerator.com/apache/htaccess.html
webmasterworld.com/forum92/226.htm