1
   

How to redirect properly to a sub folder?

 
 
View Profile 993ti
 
Reply Tue 28 Dec, 2004 08:43 pm
Well, here i am again with some redirect question.
My host recently upgraded the server and although my site can still be reached by the domain, the folder has some important other folders.
I'm on a reseller account and now i want to move the files of my site to a folder to keep things tidy and to prevent i delete something important by accident.
How would i redirect mydomain.com to a folder called home without getting 404 pages when people find the site by search engine results?
The url would be like this; domain.com/home instead of domain.com.
Any tips and/or advice?
Thanks in advance.
 
  1  
Reply Wed 28 Sep, 2005 03:13 am
1. Create index.html

2. Paste the folowing code into index.html:

Code:<html>
<head>
<title>Title here!</title>
<meta http-equiv="refresh" content="10;URL=http://www.domain.com/home.html">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<p align="center">You Will Be Redirected In 10 Seconds</span></p>
<p align="center">If not click <a href="domain.com/home.html">here</a>.</p>
</body>
</html>


3. Change the domain names to yours and adjust the 10 to however many seconds you want to go buy. Put it on 0 if you want it to transfer immediatly.
0 Replies
 
  1  
Reply Wed 28 Sep, 2005 11:45 pm
Using a meta refresh will be frowned upon pretty severely by search engines.

You should use a redirect method that sends a 301 (moved permanently) HTTP header. This is the method that has been sanctioned by search engine representatives from Google and the other major engines.

How to do so depends on the technology involved.

A PHP example is:

Code:
<?php

header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.newdomain.com/newdirectory/newpage.php");
exit();

?>


That will direct the request to that specific page.

If you want to do more at one time you should look into using mod_rewrite.

Here is an example rule:

Code:
RewriteRule ^(.*)$ http://www.newdomain.com/newdirectory/$1 [R=301,L]


That rule would redirect anything in that directory to the other directory with a 301 HTTP header.
0 Replies
 
  1  
Reply Thu 29 Sep, 2005 04:13 am
Wow! You learn something every day...
0 Replies
 
 

Related Topics

I'm the developer - Discussion by Nick Ashley
how to earn money in internet - Discussion by rizwanaraj
THANK YOU CRAVEN AND NICK!!! - Discussion by dagmaraka
The version 10 bug. Worse then Y2K! - Discussion by Nick Ashley
CSS Border style colors - Question by meesa
There is no Wisdom in Crowds - Discussion by ebrown p
mod rewrite for a different theme? - Discussion by etali
 
  1. able2know
  2. » How to redirect properly to a sub folder?
Copyright © 2009 Horizontal Verticals :: Page generated in 0.33 seconds on 11/22/2009 at 01:40:10 Top End