It is currently Sat Oct 05, 2024 2:20 am


All times are UTC




Post new topic Reply to topic  [ 1 post ] 

Do you find this article helpful?
Yes 100%  100%  [ 1 ]
No 0%  0%  [ 0 ]
Total votes : 1
Author Message
 Post subject: How to: Redirect/forward a file, folder or even a subdomain
PostPosted: Tue Jun 20, 2006 8:57 am 
Support Tech
Support Tech

Joined: Thu Mar 23, 2006 1:07 pm
Posts: 238
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.html
Simply 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.html

Code:
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:
permanent
Returns a permanent redirect status (301) indicating that the resource has moved permanently.
temp
Returns a temporary redirect status (302). This is the default.
seeother
Returns a "See Other" status (303) indicating that the resource has been replaced.
gone
Returns 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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Hosting | Domains | Servers | Extras | Order | Support | Contacts | FreeHostia © 2011