1
   

How to redirect properly to a sub folder?

 
 
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.
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Discussion • Score: 1 • Views: 922 • Replies: 3
No top replies

 
badride5
 
  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
 
Craven de Kere
 
  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
 
badride5
 
  1  
Reply Thu 29 Sep, 2005 04:13 am
Wow! You learn something every day...
0 Replies
 
 

Related Topics

Webdevelopment and hosting - Question by harisit2005
Showing an Ico File - Discussion by Brandon9000
how to earn money in internet - Discussion by rizwanaraj
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
THANK YOU CRAVEN AND NICK!!! - Discussion by dagmaraka
I'm the developer - Discussion by Nick Ashley
 
  1. Forums
  2. » How to redirect properly to a sub folder?
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 05/17/2024 at 05:13:57