Redirecting Web Pages in .htaccess using mod_alias
How to redirect a web page from one
location to another
Using mod_alias is simpler than using mod_rewrite and does the
job for most of the redirection we have to do. There are several
reasons to redirect webpages:
- The page has been moved to a different location with a different
file name or file extension
- The page no longer exists or is no longer functional and we
want to send incoming that may come from links, search engines
or bookmarks to another page.
Remember that there are two types of redirects:
- Permanent redirection: 301 Redirect
- Temporary redirection: 302 Redirect:
If we don't want visitors at that former page location, a permanent
redirect will avoid them getting a 404 error.
Redirect to another page on the same site:
Redirect 301 /oldpage.html http://www.samedomain.html/newpage.html
or
Redirect permanent /oldpage.html http://www.samedomain.html/newpage.html
Redirect to a web page on another site:
Redirect 301 /oldpage.html http://www.otherdomain.com/newpage.html
or
Redirect permanent /oldpage.html http://www.otherdomain.com/newpage.html
Redirection
Using Mod_Rewrite |
Redirecting
the Homepage
Redirecting
Web Pages using mod_alias | Creating
an .htaccess file
File Sizes | Web
Safe Colors
|