.htaccess
This method requires that you create an .htaccess file in the directory
containing the old file or in the old directory.
Creating an .htaccess File
Create your .htaccess file using a text editor (Notepad or Simpletext
are recommended, if you use Word, be sure to save the file as text only)
on your machine and then upload it as text to the directory you want
protected.
You can also log on to UTS, go to the directory you want to protect
and use an editor like Pico or Emacs to create your .htaccess file.
- .htaccess file to redirect one page to another page
RedirectPermanent pagename new-page-url
where
| pagename |
is the page that you want redirected. |
| new-page-url |
is the full URL of the location to which you want the
users sent. |
For example, this .htaccess file redirects users from old.html to UT's home
page:
RedirectPermanent old.html http://www.utexas.edu/
- .htaccess file to redirect one directory to another directory
RedirectPermanent dirname new-dir-url
where
| dirname |
is the directory that you want redirected. |
| new-dir-url |
is the full URL of the location to which you want the
users sent. |
For example, this .htaccess file (in the /admin/ohr directory) redirects
users from http://www.utexas.edu/admin/ohr/ to http://www.utexas.edu/hr/:
RedirectPermanent /admin/ohr http://www.utexas.edu/hr
Advantages
- Entire directories can be redirected at once.
- Correct URL address appears in the browser's location box.
- New location can be on a different server.
- Back button is not broken.
Disadvantages
- Graphics and links can be broken if the SRC tag is not fully specified.
- No option for showing the old page before going to the new one.
- Actual files and symbolic links in a subdirectory aren't necessarily
what is being shown on the Web.
- You have to look at the .htaccess file to know which files are displayed
with which URLs.
More Information
For more information on redirecting pages, see the Apache Module
mod_alias page.
|