Redirect (301 Permanently) without using .htaccess

advertisement logo

 

Want to redirect your website to another place but can’t create .htaccess file?

Well this might be a solution to you, if your webhost supports server site php scripting.

The codes below will tell web-client (including search bot) that your website have been Moved Permanently to a new location and redirects them to a new location

The PHP version :
header ('HTTP/1.1 301 Moved Permanently');
header ('Location: http://newdomain.com/');

The ASP version :
Response.Status="301 Moved Permanently"
Response.AddHeader "Location",\ "http://www.newdomain.com/"

What’s wrong with META Refesh tag? Well, firstly, it isn’t supported by all web-client (including bots). Secondly, the search engine will ignore the META Refresh tag and stops indexing your webpage.

By sending server response code 301 Moved Permanently, will inform that your website have been moved to another location and search bots will note that and index the new location instead. :)

p/s: This tip is useful in an event you can’t create a .htaccess file in your webhost.

Bookmark this article
  • digg
  • YahooMyWeb
  • NewsVine
  • Netvouz
  • Reddit
  • Spurl
  • Furl
  • del.icio.us
  • StumbleUpon
  • Technorati
  • TwitThis

Keep updated with this website! : Subscribe to your email

Recommended Reading

2 smashing comments for this post.

  1. SaintisKreko Said:

    this is good only if you have one page ..
    if the website has 1000 pages and you need to redirect them one by one .. still headache too..
    but if you can configure your ErrorDocument 404 .. then the problem is reduced lah..

    btw, i’ll use with HTTP/1.0 with such short response ..

  2. mypapit Said:

    I know, this thing occured to me… but still better than the lame META refresh…

    It’s handy on you index page when you dont have direct access to webserver setting and .htaccess

    Yes, the HTTP/1.0 is shorter.. :)

Leave a Comment

Subscribe by email

Enter your Email