WordPress / Web Development Tutorials
(Best WordPress Tutorials)

CSSHTMLJavaScriptjQueryMySQLPHPSilvaTechnologiesWooCommerceWordpress
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.

 

Nathan da Silva - Profile

Posted by: Nathan da Silva

Nathan is the Founder of Silva Web Designs. He is passionate about web development, website design and basically anything digital-related. His main expertise is with WordPress and various other CMS frameworks. If you need responsive design, SEO, speed optimisation or anything else in the world of digital, you can contact Silva Web Designs here; [email protected]

It’s good to share

Join the discussion

Related Posts

Related - How to Install an SSL Certificate on Apache via SSH

Technologies / 1st January 2024

How to Install an SSL Certificate on Apache via SSH

Read More Related - How to Create the Default WordPress .htaccess File

Wordpress / 1st January 2024

How to Create the Default WordPress .htaccess File

Read More