Let's say you want to redirect the user to
http://yourdomain.com/newpage.htm when he tries to load
http://yourdomain.com/oldpage.htm. You can easily do this using .htaccess. This is the line that you need to add to the .htaccess file:
Code:
Redirect oldpage.htm newpage.htm
In the cases when you want to redirect the visitor to an outside page, for example
http://otherdomain.com/somepage.htm, you just provide the full URL of the page:
Code:
Redirect oldpage.htm http://otherdomain.com/somepage.htm
Here are some other practical examples:
- redirect the subdomain
sub.domain.com to
somedomain.com/page.htmlSimply put the .htaccess in the folder where sub.domain.com points to and add the following code to it:
Code:
Redirect / http://somedomain.com/page.html
- redirect the folder
oldfolder to
newfolder/index.htmlCode:
Redirect /oldfolder newfolder/index.html
If no status argument is given, the redirect will be "temporary" (HTTP status 302). This indicates to the client that the resource has moved temporarily. The status argument can be used to return other HTTP status codes:
permanentReturns a permanent redirect status (301) indicating that the resource has moved permanently.
tempReturns a temporary redirect status (302). This is the default.
seeother
Returns a "See Other" status (303) indicating that the resource has been replaced.
goneReturns a "Gone" status (410) indicating that the resource has been permanently removed. When this status is used the url argument should be omitted.
Example:
Code:
Redirect permanent /one http://example.com/two
Code:
Redirect 303 /two http://example.com/other
For more information visit
this page.
_________________
Cheers,
Steve
Support Team Supervisor
Before asking a question,
please read the F.A.Q.