How to Set 301 Redirection using .htaccess File

In this post we will show you how to Set 301 Redirection using .htaccess File. hear we are redir apge and url both with different method.

There area unit many strategies out there using .htaccess file to redirect user from one page to a different. 301 is one of the sort to redirect user from one page to a different.

301 Redirection conjointly referred to as Permenant Redirection.

In this article we’ll see a way to created the 301 redirection from .htaccess file. 301 redirection will be setup in 2 alternative ways. we’ll see each the ways in which up here.

Unlike traditional rewrite 301 redirection can amendment the url in address bar.

How to direct explicit Page exploitation Set 301 Redirection

By using this technique we will direct Whole website using 301 site using .htaccess File

If you would like to redirect just some of the pages to be redirected to different page exploitation 301 redirection then you’ll check below strategies.


##Method :: 1
redirect 301 /your-old-page.html http://mydominname.com/your-new-page.html

##Method :: 2
RewriteRule ^your-old-page.html$ http://mydominname.com/your-new-page.html [R=301]

How to direct Whole website exploitation Set 301 Redirection

By exploitation this technique we will direct Whole website} exploitation 301 site exploitation .htaccess File

If you’re moving to new website and need all of your visitant of recent site being redirected to new site then here is that the code for you.

##Method :: 1
redirect 301 / http://mydominname.com/

##Method :: 2
RewriteRule ^(.*)$ http://mydominname.com/$1 [R=301,L]

Conclusion for Set 301 Redirection using .htaccess

So here area unit the 2 strategies with that you’ll direct your user from one page to a different page or from one website} to a different site.

each can works fine therefore its entirely up to you that one to use in you project.

You May also like :

remove .php, .html, .htm extensions using .htaccess