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
-
Fetch as Google - Redirected
Hi I have swaped from HTTP to HTTPS and put a redirect on for HTTP to redirect to HTTPS. I also put www.xyz.co.uk/index.html to redirect to www.xyz.co.uk When I fetch as Google it shows up redirect! Does this mean that I have too many 301 looping? Do I need the redirect on index.html to root domain if I have a rel conanical in place for index.html htaccess (Linix) - RewriteCond %{HTTP_HOST} ^xyz.co.uk
Intermediate & Advanced SEO | | Cocoonfxmedia
RewriteRule (.*) https://www.xyz.co.uk/$1 [R=301,L] RewriteRule ^$ index.html [R=301,L]0 -
301 Redirection
Hi there guys, I have a question about redirection. My boss has just bought a new domain name and he wants it to redirect to our current site when looking for specific products. www.example.com is our current website www.productname.com is the new domain So the new domain would be redirected to example.com. Would that be considered against Google Policies? Thanks
Intermediate & Advanced SEO | | PremioOscar0 -
Problem with redirects in coldfusion
How to redirect pages in cold fusion? If using ColdFusion and modrewrite, the URL will never be redirected from ModRewrite.
Intermediate & Advanced SEO | | alexkatalkin0 -
301 redirect subdirectory to new domain
I'm planning on using 301 redirects to spin out a subdirectory of my current website to be its own separate domain. For instance, I currently have a website www.website.com and my writers write tech news at www.website.com/news. Now I want to 301 redirect www.website.com/news to www.technews.com. Will this have any negative impact on SEO? What are some steps that I can take to minimize these impacts?
Intermediate & Advanced SEO | | Chris_Bishop1 -
301 redirections done too late - What do you suggest?
Hi, When pushing our new site live, most of the 301 redirections got done too late for several reasons. Understandably, our site rankings in google have taken a hit now. So far we have just tried to perfectly optimize the pages that used to rank well (They weren't even optimized before and were still ranking) , to get our positions back. But does anyone have an idea about what else we could do? Is there a recommended "action plan" when someone is late with their 301 redirections?
Intermediate & Advanced SEO | | JohanMattisson0 -
Domain advice needed, please
Could i get a little domain advice please. Launching a new website project and want to put it on a domain we already own (both domains are in the same niche as the larger project). The new project will be aimed at the UK market. The choice is: .co.uk we own with a good name, however it's Domain Authority rank is 7 and it's only about 8 months old. .com domain which is 6 years old, has a Domain Authority rank of 33 but is not as good a domain name. The Competitive Link Analysis tells me that the rivals for the keywords we would be targeting are between 24 and 42. Which domain would people go with? All things equal it would be a fair guess that the older, higher Domain Authority ranked .com will require less work to rank in the engines, however it's not as good brand wise. Thanks Carl
Intermediate & Advanced SEO | | Grumpy_Carl0 -
Problem w/ 301 Redirect
Here is how I did the configuration of the redirects: I don’t understand why the destination page is different from the one is configured in the apache server. Any ideas? For example: http://www.meliacaribetropical.com/spanish/entertainment/ is being already being 301 redirected to a 404 page (http://www.meliacaribetropical.com/es/index.htmlentertainment/) that does not exist on the Apache server. As you can see, the url was incorrectly written. Another occurrence from the spreadsheet is http://www.meliacaribetropical.com/spanish/gallery/beach.html, which is also being 301 redirected to a 404 page (http://www.meliacaribetropical.com/es/index.htmlgallery/beach.html). This is causing a hard 404 page. Here is my .httpaccess file: <virtualhost 192.168.200.25:80=""></virtualhost> ServerAdmin ecommerce@sol-group.com DocumentRoot /home/www/solgroup/americas/meliacaribetropical.com ServerName www.meliacaribetropical.com ServerAlias meliacaribetropical.com Redirect permanent /spanish/services/ http://www.meliacaribetropical.com/en/services.html Redirect permanent /entertainment/ http://www.meliacaribetropical.com/en/services.html Redirect permanent /press/ http://www.meliacaribetropical.com/en/index.html Redirect permanent /spanish/ http://www.meliacaribetropical.com/es/index.html Redirect permanent /es/restaurantes/ http://www.meliacaribetropical.com/es/gastronomia.html Redirect permanent /spanish/entertainment/ http://www.meliacaribetropical.com/es/servicios.html Redirect permanent /spanish/services/ http://www.meliacaribetropical.com/es/servicios.html Redirect permanent /es/spa/ http://www.meliacaribetropical.com/es/servicios.html Redirect permanent /spanish/accommodations/ http://www.meliacaribetropical.com/es/habitaciones.html Redirect permanent /spanish/spa/ http://www.meliacaribetropical.com/es/servicios.html Redirect permanent /spanish/royal/ http://www.meliacaribetropical.com/es/servicio-real.html Redirect permanent /spanish/dining/ http://www.meliacaribetropical.com/es/gastronomia.html Redirect permanent /spanish/flintstones/ http://www.meliacaribetropical.com/es/index.html Redirect permanent /es/galeria/ http://www.meliacaribetropical.com/es/visor.html Redirect permanent /spanish/gallery/ http://www.meliacaribetropical.com/es/visor.html Redirect permanent /es/reuniones-eventos/ http://www.meliacaribetropical.com/es/grupos.html Redirect permanent /lowest-rate.php http://www.meliacaribetropical.com/en/index.html Redirect permanent /es/los-picapiedra/ http://www.meliacaribetropical.com/es/index.html Redirect permanent /gallery/beach.html http://www.meliacaribetropical.com/en/index.html Redirect permanent /gallery/dining.html http://www.meliacaribetropical.com/en/gastronomy.html Redirect permanent /gallery/pools.html http://www.meliacaribetropical.com/en/index.html Redirect permanent /spanish/sitemap.html http://www.meliacaribetropical.com/es/index.html Redirect permanent /es/galeria/playa.html http://www.meliacaribetropical.com/es/index.html Redirect permanent /es/galeria/restaurantes.html http://www.meliacaribetropical.com/es/gastronomia.html Redirect permanent /es/galeria/piscinas.html http://www.meliacaribetropical.com/es/index.html Redirect permanent /es/prensa/ http://www.meliacaribetropical.com/es/index.html Redirect permanent /spanish/gallery/beach.html http://www.meliacaribetropical.com/es/index.html Redirect permanent /spanish/gallery/pools.html http://www.meliacaribetropical.com/es/index.html Redirect permanent /spanish/gallery/dining.html http://www.meliacaribetropical.com/es/gastronomia.html Redirect permanent /spanish/press/ http://www.meliacaribetropical.com/es/index.html Redirect permanent /en/groups.html http://www.meliacaribetropical.com/en/groups.html Redirect permanent /terms-condition.php http://www.meliacaribetropical.com/en/index.html Redirect permanent /es/all_inclusive.html http://www.meliacaribetropical.com/es/index.html Redirect permanent /es/terms-condition.php http://www.meliacaribetropical.com/es/index.html Redirect permanent /es/prensa/family-facilities-amenities.html http://www.meliacaribetropical.com/es/index.html Redirect permanent /es/outside-us-telephone-listing.php http://www.meliacaribetropical.com/en/index.html Redirect permanent /spanish/press/melia-international-brand-overhaul.html http://www.meliacaribetropical.com/es/index.html Redirect permanent /es/prensa/melia-international-brand-overhaul.html http://www.meliacaribetropical.com/es/index.html Redirect permanent /press/family-facilities-amenities.html http://www.meliacaribetropical.com/en/index.html Redirect permanent /press/melia-international-brand-overhaul.html http://www.meliacaribetropical.com/en/index.html Redirect permanent /es/prensa/melia-caribe-tropical-announces-fall-promotion.html http://www.meliacaribetropical.com/es/index.html Redirect permanent /spanish/press/melia-caribe-tropical-announces-fall-promotion.html http://www.meliacaribetropical.com/es/index.html Redirect permanent /press/melia-caribe-tropical-announces-fall-promotion.html http://www.meliacaribetropical.com/en/index.html
Intermediate & Advanced SEO | | Melia0 -
An Infrastructure Change for a Large eCommerce Site - Any advice?
Hello Mozers, We're currently under going quite a large infrastructure change to our website and I wouldn't to hear your thoughts on the type of things we should be careful of. We currently have close to 4,000 individual products each with their own page. The seo work is then driven behind certain pages which house a catalog display of groups of products. The groups are done by style. An example is we have a page called "Style A" which displays 8 different colours of style A. We then seo the style A page and the individual items received minimal seo work. The change would involve having one individual product page for each style but on that page the user would have the ability to purchase the different colours/variations via menus. This will result in approximately a %70 reduction in the size of our site (as several products will no longer be published) The things we are currently concerned with are: 1. The lose of equity to those unwanted 'style A' pages - I think a series of careful planned 301s will be the solution. 2. Possible loss of long tail traffic to the individual products which might not be caught by one individual page per style. 3. Internal link structure will need to be monitored to make sure that we're still highlight the most important pages as well, important. Sorry for the long post, it's a difficult change to explain without revealing the clients name - any other things we should be thinking about would be greatly appreciated! Thanks Nigel
Intermediate & Advanced SEO | | NigelJ0