Best practice to redirect http to https
-
I have an SSL certificate on our domain but at times some search results still list the HTTP version. Clicking on this then warns the user about security and they leave. To avoid this I am using this in the htaccess file to redirect all HTTP visits to the https version.
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://domain.com/$1 [R,L]Is this ok? I notice on Moz toolbar it give a 302 temporary redirect I am thinking this isn't good and needs to be a 301 maybe? What is the best practice in this situation?
-
Ok thanks anyone know what i need to do to adjust my htaccess code?
-
Sorry i mean prefferd domain https://support.google.com/webmasters/answer/44231?hl=en
I'm not familiar with customizing a htaccess file.
Kind regards,
Jeroen
-
Thanks, i have added the new domain to search console. How do you set priority domain?
Also in regard to the code i have in htaccess. What do i need to add to it to make it do a 301?
Thanks
-
Hi,
I should advise a 301 perm. redirect. remember, it wil take some time before google index all your new pages ( 6 weeks)
don;t forget to add your new domain to search console.
Kind regards,
Jeroen
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Beta Site Removal best practices
Hi everyone.
Intermediate & Advanced SEO | | bgvsiteadmin
We are doing a CMS migration and site redesign with some structural changes. Our temporarily Beta site (one of the staging environments and the only one that is not behind firewall) started appearing in search. Site got indexed before we added robots.txt due to dev error (at that time all pages were index,follow due to nature of beta site, it is a final stage that mirrors live site) As an remedy, we implemented robots.txt for beta version as : User-Agent: *
Disallow: / Removed beta form search for 90 days. Also, changed all pages to no index/no follow . Those blockers will be changed once code for beta get pushed into production. However, We already have all links redirected (301) from old site to new one. this will go in effect once migration starts (we will go live with completely redesigned site that is now in beta, in few days). After that, beta will be deleted completely and become 404 or 410. So the question is, should we delete beta site and simple make 404/410 without any redirects (site as is existed for only few days ). What is best thing to do, we don't want to hurt our SEO equity. Please let me know if you need more clarification. Thank you!0 -
HTTP → HTTPS Migration - Both Websites Live Simultaneously
We have a situation where a vendor, who manages a great deal of our websites, is migrating their platform to HTTPS. The problem is that the HTTP & new HTTPS versions will be live simultaneously (in order to give clients time to audit both sites before the hard switch). I know this isn't the way that it should be done, but this is the problem we are facing. My concern was that we would have two websites in the index, so I suggested that they noindex the new HTTPS website until we are ready for the switch. They told me that they would just add cannonicals to the HTTPS that points to the HTTP and when it's time for the switch reverse the cannonicals. Is this a viable approach?
Intermediate & Advanced SEO | | AMSI-SEO0 -
Guest Blog post best practice considering time/energy
Good morning Moz community 🙂 What do you guys think would be the best practice as a starting blogger offering guest articles to other 3rd party blogs when it comes to building up my own website's SEO points (assuming I have a link in the guest article to my website). 1. If I have the opportunity to post the guest article on two+ different blogs, should I go for it? -OR- 2. Only post the article on one specific blog and write a different one for the others? In a world with unlimited resources, the latter option would prevail, but considering that it takes time to write, what would you recommend if I am trying to build my websites SERPs? Carlos
Intermediate & Advanced SEO | | 90miLLA0 -
Big 301 Redirect Help!
Hey guys I need a little help with setting up a big 301. Background: It's a bit of a mess as the old site is a total mess after being online for 10 years plus. It has html and php pages, and a mod rewrite to redirect old html links to the newer php version of those pages. It's now moving to a new site and as the domain name and URL structure has changed we can't use any fancy regex and have to do a page to page redirect. There are 1500 pages to redirect. However, the old site has thousands of linking root domains, and some of these are to the old html pages (which currently redirect to the php pages) and some to the newer php pages. Question: My initial plan was to leave the mod rewrite and only redirect the php pages. That means 1500 individual redirects instead of 3000 if I individually redirect both the php and html pages. I'm not sure what's best to be honest. We don't really want multiple hops in the redirect (html>php>new site), but surely 1500 redirects is better than 3000! Does anyone have any advice on which option may be best, or even a better option? Thanks 🙂
Intermediate & Advanced SEO | | HarveyP0 -
Best practices for robotx.txt -- allow one page but not the others?
So, we have a page, like domain.com/searchhere, but results are being crawled (and shouldn't be), results look like domain.com/searchhere?query1. If I block /searchhere? will it block users from crawling the single page /searchere (because I still want that page to be indexed). What is the recommended best practice for this?
Intermediate & Advanced SEO | | nicole.healthline0 -
Redirection to mobile site
Calling all SEO ninjas! I'm currently developing single web pages for various clients which function as abbreviated versions of their main websites. They are all related & under a single domain. When a user visits these pages on a mobile device, CSS is used to display mobile friendly versions of these pages. My clients are thrilled with these mobile versions and now want to also redirect mobile visitors from their main site (which is not mobile optimised) to these pages. My questions are: Are there any negative implications if we did this? ie. redirecting to a different domain What is the best method for redirection? eg. JavaScript Can this be achieved by adding a single line of code to their main site Can this be done in an SEO friendly way so that the redirection acts like a backlink? Many thanks.
Intermediate & Advanced SEO | | martyc0 -
Duplicate titles but redirecting anyway (without redirects set up!!!)
Google has done a crawl of my site and is flagging up duplicate titles on my wordpress site. This appears to be due to the face that some posts are tagged in more than one category. I have just gone to make sure that each post just has one category and add redirects and I've noticed that all the duplicate title issues google has notified me about appear to redirect anyway. For example: http://www.musicliveuk.com/latest-news/live-music-boosts-australian-economy and http://www.musicliveuk.com/live-music/live-music-boosts-australian-economy have duplicate titles apparantly but the 1st url redirects to the 2nd one. I use the redirection plug in but have no redirection set up for that url so I'm a bit confused. And if they're redirecting anyway then why is google flagging up duplicate titles? Any help would be much appreciated.
Intermediate & Advanced SEO | | SamCUK1 -
Quoestion about 301 redirect
Hey, I have interesting questions regardin 301 redirect (At least I think it's Interesting:) ) So i have this websites that compares different lenders, url below 🙂 If you go to the homepage then the first thing you see is different loan amounts in 50-99 euro range. Also you can check out different loan amounts like 100-149€, 150-199€, 200-249€ and so on. For now i have used 301 redirect and Noindex and Nofollow for all the different "loan amounts" urls. Examples below etc Is it a good idea to use 301 on all such pages to point to the homepage?
Intermediate & Advanced SEO | | TauriU0