Here is a simple example of an .htaccess file placed in my public_html (root) folder:
RewriteEngine On
RewriteRule ^contact\.htm /contact-us.aspx [R=301,L]
This is checking for any request that comes in for contact.htm (notice the backslash to escape the "." before htm) and redirects the user straight on to contact-us.aspx.
The '^' is referred to as an anchor and when used means that the character(s) to the right of it must be the very first character(s) example:
^contact\.htm would match contact.htm but not nocontact.htm.You can also do the same with the last character(s) by inserting a '$'.
Don't forget that you have to have mod_rewrite enabled to make this work!
No comments:
Post a Comment