Redirect Chain Advice
-
Hi,
i hope you can help.
My site crawl is showing that I have a redirect chain on my home page. Basically it shows I am going from :
http: > https: > https://www.
I need everything to go from http:// and http://www directly to https://www. without the chain.
Below is a copy of the htaccess, can anyone see if there is an error in there that could be causing it.
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]BEGIN WordPress
<ifmodule mod_rewrite.c="">RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]</ifmodule>END WordPress
In addition, i have seen that they have a plugin called
SSL insecure content fixer installed.
It is showing this under its status:
Array ( [HTTPS] => on [PHPHANDLER] => /usr/local/php70/bin/php [HTTP_X_REAL_IP] => 109.158.20.158 [HTTP_X_FORWARDED_PROTO] => https ) I think possibly this might have something to do with the issue, any thoughts are appreciated Thanks
-
Hello there,
Actually, I think this article could really help you! https://www.danielmorell.com/guides/htaccess-seo/https-www-and-trailing-slash
Alternatively, if you want to get the rules right away, just copy below, change the "example.com" to your domain then it should be working.
Force HTTPS
Force WWW
Remove trailing / from file
Turn on rewrite engine
RewriteEngine on
Check if not directory and ends in /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$If not a directory skip next RewriteRule
RewriteRule ^ - [S=2]
Check if HTTPS and WWW
RewriteCond %{HTTP_HOST} !^www.(.*)$ [OR,NC]
RewriteCond %{https} offThis RewriteRule skipped if URI was a directory
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
This RewriteRule used if URI was a directory
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [S=1]
RewriteRule ^(.*)/$ https://www.example.com/$1 [R=301,L]Do note, this 301 redirect your URL to the version with trailing slash, and because Google sees the trailing slash and non-trailing slash version of your pages as a different page, you should be doing a 301 to the right one. Read more about it here: https://www.seroundtable.com/google-trailing-slashes-url-24943.html
Of course, you can choose to remove the trailing slash 301 redirecting, Moz doesn't redirect to either version, and they rank well. But sites like Neilpatel (they have unnecessary redirects) and Backlinko does redirect, and they rank well too. So it's up to you if you want Google to help you identify which version you prefer or you tell Google yourself.
Finally, you can use this tool to check if your redirects are working as you expected: https://httpstatus.io/ (When you test, use a blog page or a specific page to test all the 8 variations because trailing slash doesn't matter at the homepage, take a look at screenshots below)
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
-
If I redirect a subdomain, does this affect the parent domain?
Hi I have a company for example: abc.com and they have a subdomain def.abc.com with a lot of errors. These errors i believe affect the parent domain abc.com. So my company would like to redirect the subdomain to another domain altogther ex: xyz.com Can i redirect the subdomain def.abc.com to another website domain? Would this affect the parent domain in a good or bad way? Or should i be using an external links to point to a new domain for the subdomain? Trying to think what's best for SEO and the parent domain. Thanks!
Intermediate & Advanced SEO | | crodriguez890 -
Google ranking 301 redirected vanity urls
We use vanity URLs for offline marketing. An example vanity URL would be www.clientsite.com/promotion, this URL 301 redirects to a page on the site with tracking parameter ex: www.clientsite.com/mainpage?utm_source=source&utm_medium=print&utm_campaign=xyz. We are running into issues with Google ignoring the 301 redirect and ranking these vanity URLs instead of the actual page on the website. Any suggestions on how to resolve?
Intermediate & Advanced SEO | | digitalhound0 -
External Redirects & SEO
This company page redirects their external clients links: https://www.coinbase.com/clients QUESTION: What effect does this type of redirection have on the SEO going to these client pages, for their clients Websites?
Intermediate & Advanced SEO | | mstpeter0 -
301 Redirect? How to leverage the traffic on our old domain.
I've seen multiple questions about this but there's a few different answers on ways to approach it. Figured I'd personally ask for our situation. Any advice would be appreciated. We formed a new company with a new name / domain while at the same time buying an existing company in our industry. The domain and site of the company we acquired is ranking for some valuable keywords and still getting a significant amount of traffic (about half of what our new site is getting). A big downside has been, when they moved that site to a different server, something happened to where the site became uneducable so it's full of bad pricing and information. Because of that, we've had a maintenance page up for a little bit because it was generating calls to our sales team (GOOD) but the customer was having seen incredibly incorrect information (BAD) Rather than correcting those issues or figuring out why the site is un-editable, we just want to find a way where we can leverage that traffic and have them end up at our new site. Would we 301 redirect the entire domain to our new one? If we did that would the old domain still keep the majority of it's page rank?
Intermediate & Advanced SEO | | HuskyCargo1 -
Does 301 Redirect solve many problems?
Hi, there are many problems with my site. I have a lot of duplicate page titles and a lot of missing meta tags. However, I think most of them are BECAUSE i have a lot of duplicate pages. So I have read some articles and I will 301 redirect all the duplicated pages. Will this solve the problem with duplicate titles and missing meta tags as well? For example, my homepage has like 10 duplicated pages. Since they are duplicated, they have the same titles and they are all missing meta tags. I am planning to fill in meta tags JUST for the canonical page and redirect all duplicated pages to that page. Is this a good practice? Also, just curious, do different title tags and different meta tag description make the pages "not duplicated?" I assume it will still appear as duplicated.... Sorry if this was confusing...
Intermediate & Advanced SEO | | waltergah0 -
Is 301 redirect suggested on pagination pages
Hi - Due to pagination the default page of site is coming in 2 url with - ?page=1/ sub-url and /sub-url is 301 a recommended solution due to this pagination urls Also - is it required to create separate title and meta description of every pagination page We are taking specifically in context of our discounts and offer section http://www.mycarhelpline.com/index.php?option=com_offers&view=list&Itemid=9
Intermediate & Advanced SEO | | Modi0 -
I need help with htaccess redirect
Hi guys, we have the domain cheats.co.uk, it has always displayed as cheats.co.uk without the www. However it is now showing 2 version of the site, both the www. and the non www. version. I know how to add to the htaccess folder to get the non www. version going to the www. version but i am worried about doing this because the non www. version has always been the one indexed in Google and has a page rank of 3. Should i in fact be redirecting the www.version to the non www. version to keep page rank etc? or will page rank be passed over etc if i redirect to the www. version I hope thats clear Thanks guys Jon
Intermediate & Advanced SEO | | imrubbish0 -
Redirect of just one internal page
If I have 2 domains with different content that are in same topic, and each one lives on its own IP-address, what could be the result if I do permanent redirect of just one internal page from one domain to counterpart page of another? What if I use rel=canonical instead of R301? Thank you!
Intermediate & Advanced SEO | | kolio_kolev0