Posts: 943
Threads: 138
Joined: Jun 2006
Hi
I have a page, for instance domain.com/index.html
and I would like to redirect it to domain.com/directory/index.html
Right now I have an html "meta refresh" redirect, but I know that search engines such as google dont like these; they think that you are creating portals.
So what is the correct way to redirect?
Also, will the Page Rank of the page get transfered?
Thanks
Zach
Posts: 72
Threads: 3
Joined: Sep 2006
I wonder *why* you want to add "directory" in there. If you redirect it in the setup of the server (if you have access to that - or to someone who has access), rather than redirecting, wouldn't that be better?
Posts: 943
Threads: 138
Joined: Jun 2006
penguinmama Wrote:I wonder *why* you want to add "directory" in there. If you redirect it in the setup of the server (if you have access to that - or to someone who has access), rather than redirecting, wouldn't that be better?
The directory is a script which is runinng on the server, and I do not have access to it.
Posts: 72
Threads: 3
Joined: Sep 2006
Ah, bummer. How about frames? How does that affect the search engine thing? Then it would be accessed THROUGH the domain, still...
Posts: 98
Threads: 12
Joined: Nov 2006
This has me completely confused. But I am looking forward to finding the answers. Hopefully, someone clears this up for us all.
Posts: 943
Threads: 138
Joined: Jun 2006
OK this is it:
Its called a 301 Redirect. It conserves your PR and tells search engines you have moved.
Quote:IIS Redirect
- In internet services manager, right click on the file or folder you wish to redirect
- Select the radio titled "a redirection to a URL".
- Enter the redirection page
- Check "The exact url entered above" and the "A permanent redirection for this resource"
- Click on 'Apply'
Redirect in ColdFusion
<.cfheader statuscode="301" statustext="Moved permanently">
<.cfheader name="Location" value="http://www.new-url.com">
Redirect in PHP
<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.new-url.com" );
?>
Redirect in ASP
<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently" Response.AddHeader "Location", " http://www.new-url.com"
>
Redirect in ASP .NET
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://www.new-url.com");
}
</script>
Redirect Old domain to New domain (htaccess redirect)
Create a .htaccess file with the below code, it will ensure that all your directories and pages of your old domain will get correctly redirected to your new domain.
The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed)
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
Please REPLACE http://www.newdomain.com in the above code with your actual domain name.
In addition to the redirect I would suggest that you contact every backlinking site to modify their backlink to point to your new website.
Note* This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled.
Redirect to www (htaccess redirect)
Create a .htaccess file with the below code, it will ensure that all requests coming in to domain.com will get redirected to http://www.domain.com
The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed)
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]
Please REPLACE domain.com and http://www.newdomain.com with your actual domain name.
Note* This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled.
Posts: 98
Threads: 12
Joined: Nov 2006
That is really really cool! Keeping PR is SOOO important in our world of searches engines. This information is sure to come in handy for many of us.
Posts: 72
Threads: 3
Joined: Sep 2006
Wow, thanks, Zach! I didn't realize that was even possible. I see there isn't an HTML version. Can this be done in ordinary HTML?
Posts: 943
Threads: 138
Joined: Jun 2006
penguinmama Wrote:Wow, thanks, Zach! I didn't realize that was even possible. I see there isn't an HTML version. Can this be done in ordinary HTML?
I don't link so.
After server side code, you are left with metarefersh:
Code:
<html>
<head>
<meta http-equiv="refresh" content="0;url=http://www.somacon.com/">
</head>
<body>
This page has moved to <a href="http://somacon.com/">http://somacon.com/</a>
</body>
</html>
or j
avascript:
Code:
<html>
<head>
<script type="text/javascript">
window.location.href='http://www.somacon.com/';
</script>
</head>
<body>
This page has moved to <a href="http://somacon.com/">http://somacon.com/</a>
</body>
</html>
But as you can see, none of these indicate a 301 Status code. It then dosen't communicate to search engines that you have permanentely moved the resource/page. It can even make you look like a portal and hence lose in the rankings.
Posts: 25
Threads: 1
Joined: Dec 2006
Thats really cool.
But how do i do 301 request?