We promised yesterday that we’d post how to perform a 301 redirect if you do not have mod-rewrite enabled or the ability to add a .htaccess file or if you are using a windows server.
To perform a correct 301 permanent redirect the User Agent visiting the webpage (maybe a web browser or search engine spider) must be gieven the correct http status code in the header that it receives when it requests the page.
In PHP we can perform the function like this by adding the following code to the top of the webpages of the old site:
<?php
Header( “HTTP/1.1 301 Moved Permanently” );
Header( “Location: http://www.website-2.com” );
?>
* note that you’ll need to do this for each page that you want to redirect
On a windows server you can redirect the whole site or a subfolder from the IIS management snapin:
Right click on the website in the management console tree and choose properties
From there select the home directory tab.
At the top of the tab is should show a message worded like:
‘When connecting to this resource, the content should come from:’
Select the final of the three radio buttons ‘A redirection to a URL’
Under this put the URL in the input field marked ‘Redirect to:
Then check the final checkbox ‘A permanent redirection for this resource’.
Finally click on apply / ok – job done.
Of course you very possibly won’t have this level of access on a windows hosting server in which case you can perform the redirect using ASP.
In the top of each ASP you would need to add:
<%
Response.Status=”301 Moved Permanentlly”
Response.AddHeader “Location”,”http://www.website-2.com/newpage.asp”
%>







0 comments ↓
There are no comments yet...Kick things off by filling out the form below.
Leave a Comment