Inside A Html File?
RSS

Inside A Html File?

Category: FAQ   Time: 2009-12-24   Tags: , , , ,

I have been trying for a couple hours to do a 301 redirect on my GoDaddy Unix based hosting account. I have tried dozen’s of online suggestions including the one’s from godaddy.com. http://help.godaddy.com/article.php?article_id=234
I am trying to redirect an old .html file with good SEO ranking to a new .php file.
I have very limited experience with php except the above include code. However, I don’t believe the above php code will work iside a html file. (Godady only has code for a php file, not a html file)
(I have been searching the internet and aparently a lot of people have had trouble reconfiguring .htaccess files and the above linked scripts for a 301. )

Next: What Is Webiste Hosting?
Previous: I Want To Start A Internet Business But..?
"Inside A Html File?" was posted on Thursday, December 24th, 2009 at 3:25 am.

5 Responses to “Inside A Html File?”
  1. Doug V(2009-12-24):

    To expand on Jeffrey C’s answer, which is the right way to proceed, you should replace the HTML file with a new file, that will route people to the new content:








    This page has moved. It is located at New Page.



    The code above will use both the meta-refresh tag, a JavaScript redirect and a physical link.
    You should also add a robots.txt text file to your site to get search engines to stop indexing the old page:
    User-agent: *
    Disallow: /oldpage.html

  2. Jeffrey C(2009-12-24):

    PHP will not function with an HTML extension. The server knows it’s a PHP file by its PHP extension. Why not use a META Refresh to redirect, or some Java Scripting?
    Put this between the tags somewhere:

    or this inside your tags:

    These will redirect in 2 seconds.

  3. glynn.al(2009-12-24):

    try any of these
    ‘301 Redirect in ColdFusion’
    < .cfheader statuscode=”301″ statustext=”Moved permanently”>
    < .cfheader name=”Location” value=”http://www.new-site.com”>
    ‘301 Redirect in PHP’
    < ?php
    Header( “HTTP/1.1 301 Moved Permanently” );
    Header( “Location: http://www.new-site.com” );
    ?>
    ‘301 Redirect in ASP’
    < %@ Language=VBScript %>
    < %
    Response.Status=”301 Moved Permanently”
    Response.AddHeader “Location”, ”
    http://www.new-site.com”
    >
    ‘301 Redirect in ASP .NET’

  4. SteveC(2009-12-24):

    Try this
    < ?php
    $newLocation =
    http://www.yoursitename.com/thisfile.php ;
    header (’HTTP/1.1 301 Moved Permanently’);
    header (’Location: ‘.$newLocation);
    exit();
    ?>
    Note that this HAS to go before any text is sent to the browser
    or you get a ‘header already sent’ error.
    Edit: Forgot to add “exit();”
    EDIT **Solve by creating a .htaccess **
    Just noticed their that your still having the prob, well just stick this in a .htaccess file in the folder (or root folder for all files on server to be effected)
    AddType application/x-httpd-php .php .php3 .html .htm
    That tells apache what file types to allow php to process as php. Hope that helps

  5. D(2009-12-24):

    php code MUST reside inside of a file called .php. The php extenstion forces the server to call internal pre processor engine. Ordinary webserver’s have no idea what php is.

Leave a Reply

 
Recent Posts
Random Posts