How to create a 301 redirect

1,585 views

Published on

How to create a 301 Redirect

* Search Engine Friendly Method
* Change Page URLs with 301 redirects
* Permanently moved to a new location
* Can remove canonical issues(redirects to only www.domain.com) – webmaster can also be used to solve it
* Google understand these (www.abc.com and abc.com) as a different URL.
* Google recommends using a 301 redirect to change the URL of a page as it is shown in search engine results

www.gsesoftsolutions.com
A Tech Blog
Twitter: @GSESoftSolution
My Facebook Page @gsesoftsolutions

Published in: Internet, Technology, Design
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,585
On SlideShare
0
From Embeds
0
Number of Embeds
139
Actions
Shares
0
Downloads
6
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

How to create a 301 redirect

  1. 1. How to create a 301 Redirect www.gsesoftsolutions.com A Tech Blog Twitter: @GSESoftSolution My Facebook Page @gsesoftsolutions
  2. 2. 301 Redirect • Search Engine Friendly Method • Change Page URLs with 301 redirects • Permanently moved to a new location • Can remove canonical issues(redirects to only www.domain.com) – webmaster can also be used to solve it • Google understand these (www.abc.com and abc.com) as a different URL. • Google recommends using a 301 redirect to change the URL of a page as it is shown in search engine results
  3. 3. Client Request • GET /index.php HTTP/1.1 Host: www.example.org • HTTP/1.1 301 Moved Permanently Location: http://www.example.org/index.asp Server Response
  4. 4. Redirect to www using htaccess redirect • RewriteEngine on rewritecond %{http_host} ^domain.com [nc] rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]
  5. 5. Redirect Old Domain to New Domain using 301 Redirect • RewriteEngine on RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
  6. 6. Ruby on Rails Redirect • def old_action headers["Status"] = "301 Moved Permanently" redirect_to "http://www.new-domain.com/" end
  7. 7. JSP (Java Server Pages) Redirect • <% response.setStatus(301); response.setHeader( "Location", "http://www.new-domain.com/" ); response.setHeader( "Connection", "close" ); %>
  8. 8. CGI PERL Redirect • $q = new CGI; print $q->redirect("http://www.new- domain.com/");
  9. 9. ASP(Active Server Pages) Redirect • <%@ Language=VBScript %> <% Response.Status="301 Moved Permanently" Response.AddHeader "Location","http://www.new-domain.com/" %>
  10. 10. PHP(Hypertext Preprocessor) Redirect • <? Header( "HTTP/1.1 301 Moved Permanently" ); Header( "Location: http://www.new- domain.com" ); ?>
  11. 11. ColdFusion Redirect • <.cfheader statuscode="301" statustext="Moved permanently"> <.cfheader name="Location" value="http://www.new-domain.com">
  12. 12. IIS Redirect • Start > Program > Administrative Tool > Go to Internet Service Manager • Right click on the file or folder which you need to redirect • Select a title named ‘redirection to a url’ • Enter the name of the page • Check the both the checkbox ‘A permanent redirection for this resource’ and ’exact url entered above’ and click on apply
  13. 13. Check this Dialog Box
  14. 14. ASP.NET Redirect • <script runat="server"> private void Page_Load(object sender, System.EventArgs e) { Response.Status = "301 Moved Permanently"; Response.AddHeader("Location","http://www .new-domain.com"); } </script>
  15. 15. Thanks for Watching  www.gsesoftsolutions.com A Tech Blog Twitter: @GSESoftSolution My Facebook Page @gsesoftsolutions

×