Helping you build a better website
(and other interesting web stuff)

CSSHTMLJavaScriptjQueryMSSQLMySQLPHPTechnologiesWordpress
Silva Web Designs - Blog

301 Redirects via .htaccess

The cleanest way to redirect a URL in a quick, easy, and search-engine friendly way is to do them through your .htaccess file which is usually found in your websites root folder (ie. httpdocs).

Note: htaccess stuff is for Apache servers only.

Redirect a single page


Redirect 301 /oldwebpage/ http://www.yourwebsite.com/newpage.html
Redirect 301 /oldwebpage2.html http://www.yourwebsite.com/folder/

Redirect an entire site


Redirect 301 / http://newwebsite.com/

Meta Refresh

An alternative way is to do a Meta Refresh, this is a line of code you would add between the elements. The following redirects to the specified URL in 3 seconds. Set to 0 for an immediate redirect.


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

301 Redirect Code Generator

If you need help generating the code for your redirects you can visit this website.

It will allow you to generate the code you need and supports web pages redirection for HTML, PHP, ASP, ASPX files and .htaccess redirect.

It’s good to share

Join the discussion