Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

In a web debugger, the html of a 301 redirect page shows up as:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="http://www.website.com/webpage.htm">here</a>.</p>
</body></html>

I'm having to redirect html pages without server support. If I replace the pages html with the code above, will that work the same as writing 301 redirects in .htaccess on apache? I looked this up on google, but the sites talking about 301 redirects didn't cover this option for redirecting html pages.

share|improve this question
add comment

3 Answers

up vote 10 down vote accepted

Ideally you will send a 301 HTTP response status code. If you can't do that a meta refresh that is immediate will also work and be counted as a 301 or 302 redirect depending on the search engine.

<meta http-equiv="refresh" content="0;url=http://example.com/new.html">

The refresh rate must be zero for it to be considered a 30x redirect.

share|improve this answer
    
Thanks, that article articulates the process really well. 0 delay meta refresh inside my html example above = poor man's 301. –  JMC May 13 '11 at 2:49
add comment

No, simply replacing the HTML with your example will not achieve the effect you're looking for. It will simply show that page to the user, since Apache will send a '200' status code along with it. Users will be able to click the link to find the page but it will not happen automatically and spiders will not know that you mean to effect a permanent redirection of the resource.

You will need to use a proper Redirect or _mod_rewrite_ directive in either .htaccess or your Apache conf files.

Alternatively, if you are actually using PHP or something similar you can set the return code to 301, output a Location response header and then your page based solution will work. In PHP it would look something like this:

<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.new-url.com" );
?> 
share|improve this answer
    
+1 Good points about the 200 status code. Didn't think about that. Unfortunately it's an IIS server and i don't have access deeper than ftp. The pages are .html so an asp redirect won't process. –  JMC May 13 '11 at 2:53
    
In that case John Conde's answer is best -- I'd forgotten about meta refresh equivalence. –  Hissohathair May 13 '11 at 7:30
add comment

Agree with Hissohathair in that your approach will not actually redirect. Users may know to click the link, but the original page will still return a normal '200' status code and continue to show up on search results (probably not quite what you want).

In order to maintain page rank, 301 status codes are extremely important. Adding meta refresh tags is also a good option and may help in most cases (as per John's response), but you may not be guaranteed that the search engines will accept it as a 301 redirect in the future. Adding proper redirects to your .htaccess (or Apache conf files) would be your best option in order to guarantee the 301 status code is being sent.

Edit:

=======================

For an IIS7 website, as long as the IIS URL Rewrite module is installed, you can create redirect rules in the web.config for the site. These rules would apply to .html files as well. More info here:

http://learn.iis.net/page.aspx/461/creating-rewrite-rules-for-the-url-rewrite-module/

=======================

Another alternative if your web host does not have .htaccess/mod_rewrite capabilities might be to change the web host you are using where you can setup server-side redirects. As long as the site is properly moved, it should be fairly seamless to your users. This approach would only be for extreme cases if maintaining page rank is highly critical.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.