SlideShare a Scribd company logo
How to create a 301 Redirect
www.gsesoftsolutions.com
A Tech Blog
Twitter: @GSESoftSolution
My Facebook Page
@gsesoftsolutions
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
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
Redirect to www using htaccess
redirect
• RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1
[r=301,nc]
Redirect Old Domain to New Domain
using 301 Redirect
• RewriteEngine on
RewriteRule (.*)
http://www.newdomain.com/$1 [R=301,L]
Ruby on Rails Redirect
• def old_action
headers["Status"] = "301 Moved Permanently"
redirect_to "http://www.new-domain.com/"
end
JSP (Java Server Pages) Redirect
• <%
response.setStatus(301);
response.setHeader( "Location",
"http://www.new-domain.com/" );
response.setHeader( "Connection", "close" );
%>
CGI PERL Redirect
• $q = new CGI;
print $q->redirect("http://www.new-
domain.com/");
ASP(Active Server Pages) Redirect
• <%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader
"Location","http://www.new-domain.com/"
%>
PHP(Hypertext Preprocessor) Redirect
• <?
Header( "HTTP/1.1 301 Moved Permanently"
);
Header( "Location: http://www.new-
domain.com" );
?>
ColdFusion Redirect
• <.cfheader statuscode="301"
statustext="Moved permanently">
<.cfheader name="Location"
value="http://www.new-domain.com">
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
Check this Dialog Box
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>
Thanks for Watching 
www.gsesoftsolutions.com
A Tech Blog
Twitter: @GSESoftSolution
My Facebook Page
@gsesoftsolutions

More Related Content

PDF
JSP Technology II
PDF
JSP Standard Tag Library
PDF
Lecture 5 JSTL, custom tags, maven
PPT
Jstl Guide
PPTX
jstl ( jsp standard tag library )
PPT
JSP Standart Tag Lİbrary - JSTL
PDF
Java Day-3
PPT
JSP Technology II
JSP Standard Tag Library
Lecture 5 JSTL, custom tags, maven
Jstl Guide
jstl ( jsp standard tag library )
JSP Standart Tag Lİbrary - JSTL
Java Day-3

Similar to How to create a 301 redirect (15)

PPTX
How (& Why) To Redirect a URL
PPT
04 Architecting Navigation
PPTX
301 Redirection in WordPress - The Ultimate Guide
PDF
Why Everyone Should be an Expert of 301 Redirects
PPT
how_to_move_your_website_without_chaos-andy_langton.ppt
PDF
Setting up CNAME on Go daddy
PDF
seo - on page - part iv - link structure
PPTX
WordPress Ann Arbor: Redirects and Robots for Accurate Analytics Results
PPTX
Big Site Migrations- Michal Magdziarz, CEO of DeepCrawl
PPTX
301 vs 302 Redirects
PPTX
Technical SEO Face-Off
PPTX
Whats Less Harmful 301 Redirect or 404 Error Pages?
PPT
Google Bot Herding, PageRank Sculpting and Manipulation
PPT
Advanced SEO for Web Developers
PPTX
Domain Redirection: A Tutorial
How (& Why) To Redirect a URL
04 Architecting Navigation
301 Redirection in WordPress - The Ultimate Guide
Why Everyone Should be an Expert of 301 Redirects
how_to_move_your_website_without_chaos-andy_langton.ppt
Setting up CNAME on Go daddy
seo - on page - part iv - link structure
WordPress Ann Arbor: Redirects and Robots for Accurate Analytics Results
Big Site Migrations- Michal Magdziarz, CEO of DeepCrawl
301 vs 302 Redirects
Technical SEO Face-Off
Whats Less Harmful 301 Redirect or 404 Error Pages?
Google Bot Herding, PageRank Sculpting and Manipulation
Advanced SEO for Web Developers
Domain Redirection: A Tutorial
Ad

More from R K Gupta (13)

PDF
Karma Ebook in hindi
PDF
प्रजापिता ब्रह्माकुमारीज धनबाद सेंटर शिव जयंती
PDF
Maha Shivratri Prabhat Khabar Full Page Sewa 12 Feb 2018
PDF
Mysteries Of The Universe - E-Book Brahma Kumaris
PPTX
Top 5 Wordpress Marketing Tips - GSE Soft Solutions
PPTX
Top 12 business wordpress responsive themes
PPT
Secure Life New plan
PPTX
How to change the skype password
PPTX
How to get add ons in google docs and sheets
PPTX
Robots.txt vs rel=nofollow vs meta robots nofollow tutorial
PPTX
10 facebook business page tips and tricks
PPTX
17 tips to save your i phone's battery
PPT
Most famous quotes about life by GSESoftSolution
Karma Ebook in hindi
प्रजापिता ब्रह्माकुमारीज धनबाद सेंटर शिव जयंती
Maha Shivratri Prabhat Khabar Full Page Sewa 12 Feb 2018
Mysteries Of The Universe - E-Book Brahma Kumaris
Top 5 Wordpress Marketing Tips - GSE Soft Solutions
Top 12 business wordpress responsive themes
Secure Life New plan
How to change the skype password
How to get add ons in google docs and sheets
Robots.txt vs rel=nofollow vs meta robots nofollow tutorial
10 facebook business page tips and tricks
17 tips to save your i phone's battery
Most famous quotes about life by GSESoftSolution
Ad

Recently uploaded (20)

PDF
💰 𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓 💰
PPTX
t_and_OpenAI_Combined_two_pressentations
PPTX
E -tech empowerment technologies PowerPoint
PPT
Design_with_Watersergyerge45hrbgre4top (1).ppt
PDF
SASE Traffic Flow - ZTNA Connector-1.pdf
PPTX
Internet___Basics___Styled_ presentation
DOCX
Unit-3 cyber security network security of internet system
PDF
The New Creative Director: How AI Tools for Social Media Content Creation Are...
PDF
Exploring VPS Hosting Trends for SMBs in 2025
PPT
250152213-Excitation-SystemWERRT (1).ppt
PPTX
Power Point - Lesson 3_2.pptx grad school presentation
PPTX
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
PPT
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
PDF
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
PDF
Sims 4 Historia para lo sims 4 para jugar
PDF
Introduction to the IoT system, how the IoT system works
PDF
mera desh ae watn.(a source of motivation and patriotism to the youth of the ...
DOC
Rose毕业证学历认证,利物浦约翰摩尔斯大学毕业证国外本科毕业证
PPTX
newyork.pptxirantrafgshenepalchinachinane
PDF
Unit-1 introduction to cyber security discuss about how to secure a system
💰 𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓 💰
t_and_OpenAI_Combined_two_pressentations
E -tech empowerment technologies PowerPoint
Design_with_Watersergyerge45hrbgre4top (1).ppt
SASE Traffic Flow - ZTNA Connector-1.pdf
Internet___Basics___Styled_ presentation
Unit-3 cyber security network security of internet system
The New Creative Director: How AI Tools for Social Media Content Creation Are...
Exploring VPS Hosting Trends for SMBs in 2025
250152213-Excitation-SystemWERRT (1).ppt
Power Point - Lesson 3_2.pptx grad school presentation
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
Sims 4 Historia para lo sims 4 para jugar
Introduction to the IoT system, how the IoT system works
mera desh ae watn.(a source of motivation and patriotism to the youth of the ...
Rose毕业证学历认证,利物浦约翰摩尔斯大学毕业证国外本科毕业证
newyork.pptxirantrafgshenepalchinachinane
Unit-1 introduction to cyber security discuss about how to secure a system

How to create a 301 redirect

  • 1. How to create a 301 Redirect www.gsesoftsolutions.com A Tech Blog Twitter: @GSESoftSolution My Facebook Page @gsesoftsolutions
  • 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. 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. Redirect to www using htaccess redirect • RewriteEngine on rewritecond %{http_host} ^domain.com [nc] rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]
  • 5. Redirect Old Domain to New Domain using 301 Redirect • RewriteEngine on RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
  • 6. Ruby on Rails Redirect • def old_action headers["Status"] = "301 Moved Permanently" redirect_to "http://www.new-domain.com/" end
  • 7. JSP (Java Server Pages) Redirect • <% response.setStatus(301); response.setHeader( "Location", "http://www.new-domain.com/" ); response.setHeader( "Connection", "close" ); %>
  • 8. CGI PERL Redirect • $q = new CGI; print $q->redirect("http://www.new- domain.com/");
  • 9. ASP(Active Server Pages) Redirect • <%@ Language=VBScript %> <% Response.Status="301 Moved Permanently" Response.AddHeader "Location","http://www.new-domain.com/" %>
  • 10. PHP(Hypertext Preprocessor) Redirect • <? Header( "HTTP/1.1 301 Moved Permanently" ); Header( "Location: http://www.new- domain.com" ); ?>
  • 11. ColdFusion Redirect • <.cfheader statuscode="301" statustext="Moved permanently"> <.cfheader name="Location" value="http://www.new-domain.com">
  • 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
  • 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. Thanks for Watching  www.gsesoftsolutions.com A Tech Blog Twitter: @GSESoftSolution My Facebook Page @gsesoftsolutions