1 / 3
Caption Text
2 / 3
Caption Two
3 / 3
Caption Three margin testing

Saturday, June 19, 2010

Redirect Visitors To a New Page or Site

http://www.webweaver.nu/html-tips/web-redirection.shtml
Click the above link to see examples

Method 1 - .htaccess 301 Redirect

The smoothest way to redirect your visitors is to use an .htaccess redirect. This has no delay since before a page is served to the browser the server checks first for an .htaccess file... if it sees this the old page never loads, instead visitors are sent directly to the new page.

These are a few .htaccess redirect codes that I've used that might come in handy for you. This is not a complete list by any means, but it took me ages to find how to do these so I'll save you the hassle and list them here. Oh, and please don't email me with questions about how these work, like I said, I found these with the help of others.. I have no idea in the slightest how to write this stuff and take no credit (or responsibility) for how they work.

If you're more technically minded than I am and want the information straight from the source, check the Apache Tutorial: .htaccess files for more detailed info.

Method 2 - Meta Redirect

I'd really advise against redirecting this way! Most search engine are having difficulties with this one (and spammers have been using this in very bad ways) and it might get your page in a heap of trouble! Some browsers also don't read it properly so your would-be visitors may get stranded. Seriously, it really isn't advisable to use this anymore but if you insist on trying it, here it is.

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

Content="10; tells the browser to wait 10 seconds before transfer, choose however long you would like, you can even choose 0 to give a smoother transition.

Final Notes

I can't stress enough how important it is to test your server's response headers any time you make a change to your .htaccess file! If you use Firefox the LiveHTTPHeaders extensions is the best I've ever found. That will tell if you're sending a 301 (permanent redirect), 302 (temporary redirect, not what you want probably!) or 200 which means page found, as well as a ton of other info.

Featured Post

Windows和Ubuntu双系统完全独立的安装方法

http://www.ubuntuhome.com/windows-and-ubuntu-install.html  | Ubuntu Home Posted by Snow on 2012/06/25 安装Windows和Ubuntu双系统时,很多人喜欢先安装windows,然...