Jump to content

How to re-direct requests for one page to another via .htaccess file ?


tmyonline

Recommended Posts

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 status old-url new-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. If you created the file, you may need to set the permissions to be web readable. If you have access to the chmod command then type chmod 664 .htaccess.

 

an example for .htaccess file would contain the line

redirect permanent /techrx/test http://new_url/

change the "/techrx/test" with the path you want to redirect

change the "http://new_url/" with the new url

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.