Redirect (301 Permanently) without using .htaccess
|
|
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.
Keep updated with the latest posts, be a part of over 1,000 subscribers! :
Subscribe to your email
You might also want to read...
- Mypapit.net is alive!
- How to find cause of heavy usage on your Apache webserver
- Warning – Please Ignore this email
- Using Apache mod_security and .htaccess to block comment spam on the web
- How to set the correct Android *.apk MIME Type for Apache Webserver
- Using htaccess to stop Bad Bots from stealing bandwidth and crashing your server
- Ubuntu 6.10 Edgy Eft unavailable for Ship It


August 14th, 2005 at 12:54 am
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 ..
August 14th, 2005 at 1:59 am
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.. :)