Using Apache to Redirect Pages
In this article I explain how to do a 301 and 302 redirect using Apache's .htaccess file.
Are you having trouble with htaccess redirects? No worries, they are easy!
In this article I explain how to do a 301 and 302 redirect using Apache’s .htaccess file.
To use a 301 redirect you need to have Apache and Apache’s mod_rewrite installed.
What is a 301 Redirect?
A 301 redirect means the page is moved permanently. A search engine will update this link and give the existing page rank to the new url.
What is a 302 Redirect?
A 302 redirect means the page is moved temporary. A search engine will check the original link each time it crawls.
How to do redirects in .htaccess
In your .htaccess file place the following
#This is how you do a 301 redirect redirect 301 /old-page.html https://domain.com/new-page.html #This is how you do a 302 redirect redirect 302 /old-page.html https://domain.com/new-page.html # How to do an exact redirect with and without the last slash: RedirectMatch 301 ^/blog/?$ /blog/1
301 redirects are pretty straight forward, but they can get far more complex.
You need to login to comment.