LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-19-2015, 03:33 AM   #1
MeghanClaire
LQ Newbie
 
Registered: Jun 2015
Posts: 5

Rep: Reputation: Disabled
should i use 301 redirect or not?


Hi,

My current website url is: http://www.example.com and I will release a completely new website that will use a SSL Certificate and because its a full new website all the urls will be new and different from the old website. I'm using Hostforlife.eu hosting service, they told me to use the following lines on my .htaccess file:

Code:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
But when researching for this on google, I have found many websites telling that we should always use a 301 redirect and to do that the .htaccess file should be:

Code:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
So in order to resume, its the same domain, but now with a SSL Certificate and a full new website. In this case do I need to use the 301 redirect on my .htaccess file?
Thanks
 
Old 06-19-2015, 09:52 PM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 3,879
Blog Entries: 1

Rep: Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998
Welcome to LQ!

Your choice really, but I would suggest the 301 from the information you have provided.

From Apache docs:

Quote:
Any valid HTTP response status code may be specified, using the syntax [R=305], with a 302 status code being used by default if none is specified.
So if you use R without a code, 302 will be used.

From w3c HTTP/1.1 specs:

Quote:
10.3.2 301 Moved Permanently

The requested resource has been assigned a new permanent URI and any future references to this resource SHOULD use one of the returned URIs...

The new permanent URI SHOULD be given by the Location field in the response.

10.3.3 302 Found

The requested resource resides temporarily under a different URI. Since the redirection might be altered on occasion, the client SHOULD continue to use the Request-URI for future requests.
From your information it looks to me as if you intend the move to be permanent. Additionally, since the URL mapping is completely different there is no point in the client keeping the old URL as 302 would imply, so just get them to the new site and they will need to locate and bookmark the corresponding new information.

So, yes I would say use the 301.

Last edited by astrogeek; 06-19-2015 at 10:01 PM.
 
1 members found this post helpful.
Old 06-20-2015, 04:37 AM   #3
Tim Abracadabra
Member
 
Registered: May 2014
Location: USA, Wherever I may Roam
Distribution: Debian w/Xfce, LFS 7.9, ++
Posts: 117

Rep: Reputation: Disabled
Hi MeghanClaire,

Just wanted to expand on astrogeek's spot on info.

The redirect in your post only changes http:// URLs to https:// URLs.
As mentioned, no consideration is given to the pre-existing or old URLs,
and old bookmarks from your current audience will get 404 not found errors
as well as any links from other web sites.

Also, search engines like Google, Bing,.. will keep all your old pages in their
index for a significant amount of time (Days, Weeks, Months, ...) after they are
gone and except for your home page there will be a mix of the old and new pages.

In addition to this, search engines use the previous backlinks(Links to your pages)
as a metric in ranking your site's pages for search queries. Without those
backlinks, in addition to the aforementioned drawbacks, you risk a drop in rankings.

I would recommend 301 redirecting your old pages to the new page URLs that have the most relevant content. This can really help you maintain your current audience, new visitors and search engine ranking.

While this Google article also takes in consideration domain name changes, it
is a good read for just URL and protocol changes as well: Move a site with URL changes.

Another relevant article is: Change page URLs with 301 redirects.

Hope that helps,
Tim

Last edited by Tim Abracadabra; 06-20-2015 at 04:54 AM. Reason: Add another reference link and clarification.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How can I .htaccess 301 redirect all pages/files (EXCEPT FOR ONE) to new domain? kenweill Programming 5 06-18-2015 08:40 AM
301 Redirect Dynamic Index.php Only dtown411 Linux - Server 3 09-08-2013 02:58 AM
[SOLVED] Creating 301 Permanent Redirect to a domain with same docroot as old domain. MarkToronto Linux - Newbie 1 05-15-2013 04:35 AM
301 redirect not working after setting up .htaccess file jprine Linux - Newbie 1 09-23-2011 05:03 PM
cannot get 301 redirect to function geoman Linux - General 4 01-17-2006 09:23 PM


All times are GMT -5. The time now is 04:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration