Author Topic: Using the .htaccess file to redirect file requests.  (Read 3868 times)

Offline certforumz

  • Cert Exams
  • Administrator
  • Hero Member
  • *****
  • Posts: 771
  • Ask me a question ...
    • CertExams - CCNA, A+, Network+, and Others
Using the .htaccess file to redirect file requests.
« on: May 05, 2010, 09:30:39 PM »
Using the .htaccess file to redirect file requests.


.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.

RewriteEngine On
Redirect /ccna-simulator/sim.html
Note that \"RewriteEngine On\" command is essential.
You can also redirect any other file extensions. Redirection can be made to external domains also.');
« Last Edit: July 08, 2016, 04:54:43 AM by certforumz »