Avoid landing page redirects
-
Avoid landing page redirects for the following chain of redirected URLs.
Anyone know how to solve this issue the correct way?
-
Oh, sorry. Somehow I didn't get any notification on your reply.
For IIS you could go with web.config of your website. The code will be something like:
<rule name="Force WWW and SSL" enabled="true" stopprocessing="true"><match url="(.*)"><conditions logicalgrouping="MatchAny"><add input="{HTTP_HOST}" pattern="^[^www]"><add input="{HTTPS}" pattern="off"></add></add></conditions>
<action type="Redirect" url="https://www.domainname.com/{R:1}" appendquerystring="true" redirecttype="Permanent"></action></match></rule> -
We are using IIS as a web server, not Apache.
-
Thanks Istvan.
Where would I place this code?
-
Agreed! Forcing the rewrite will solve the problem, I'm guessing OP is currently using 301 redirects to send people to HTTPS.
-
Hi Sammy,
If I understand your question, you need help with htaccess code to force both https and www with same rule? If so, this might be what you are looking for:
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www.domainname.com$ [NC]
RewriteRule ^(.*)$ https://www.domainname.com/$1 [L,R=301]
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
-
Redirecting a blog
We've acquired another company and want to redirect their soon-to-be-obsolete website to ours. It includes a blog with many blog posts. Should we: only 301 redirect the top level blog URL
Technical SEO | | Caro-O
try redirect individual blogs to blogs of a similar topic on our site (least practical I'm sure)
redirect all their individual posts to our main blog URL Thanks, Caro1 -
Remove a page after redirection
Hi, I had page eg. www.example.com/page1 and I redirect 302 it to > www.example.com/page2 After that I fatch this page (page2) with GSC and this page was index in serp. Can I remove this old redirect page > www.example.com/page1 now? Will this remove harm my page?
Technical SEO | | Tormar0 -
Google showing https:// page in search results but directing to http:// page
We're a bit confused as to why Google shows a secure page https:// URL in the results for some of our pages. This includes our homepage. But when you click through it isn't taking you to the https:// page, just the normal unsecured page. This isn't happening for all of our results, most of our deeper content results are not showing as https://. I thought this might have something to do with Google conducting searches behind secure pages now, but this problem doesn't seem to affect other sites and our competitors. Any ideas as to why this is happening and how we get around it?
Technical SEO | | amiraicaew0 -
301 Redirect Have no ranking
Hi Guys wonder if you can help my site www.economy-car-leasing.co.uk has just been 301 from www.economyleasinguk.co.uk The reason for the move is the site is going to be structured for both cars and vans separately we did the 301 around 8 weeks ago and initially we thought everything went well, all the new site was indexed within 24 hours, we updated WMT on the old site we monitored around 150 keywords many were top 10 in Google 99% were top 5 pages However 8 weeks on we do not rank for hardly anything, i have confirmed all the redirects are working, we have 200 ok from the home page and all the other canonical pages return 301 we just implemented the canonical tag to all pages. we did factor that we will get some down time but not 8 weeks worth, i have done a 301 on this scale before with no real loss of rankings (Different site) Really tempted to put the old site back however its not what i want to do, Bing seems to have picked up on the change really well but im thinking Google just needs time The change looks like its done perfectly and everything is working as it should however it looks like that none of the original rankings or juice has been pushed over from Google yet and im wondering how long does it typically take to get the site ranking again site have gone from 17k unique s per month to less than 2k Paul
Technical SEO | | kellymandingo0 -
301 redirects
At the moment it's possible to access the home page of my website via two different urls, with and without www. and you've told me that this can be resolved with Canonicalization and a 301 redirect. Do I do this with my web hosting package or in my html pages? If I can't do it with my web host (1&1) then is there an idiot's guide of how to do it yourself? I've also got both the domain vamospaella.co.uk and vamospaella.com. Is it better to have one of these redirecting to the other for UK traffic (at the moment .co.uk redirects to .com) Thanks
Technical SEO | | melissa10 -
301 Redirect Domain or 301 Redirect Domain + Interior Pages
Hello - My company acquired another company in our industry and our IT team immediately set up the acquired companies domain name as a an alias to our site. This created a duplicate version of our website under another domain name and Google started ranking interior pages from the aliased acquired site for several top keywords that were previously held by our real site. Should we 301 redirect just the top level domain name of the acquired site to the real site or 301 redirect the top level domain name and the interior pages on the acquired site to help ensure that our real domain will take back the rankings it once had? Thanks!
Technical SEO | | Room2140 -
301 Redirect
Hi there, We are re-branding & re-structuring our website, there will be quite a number of 301 re-directs, possibly hundreds. The question is: Should i wait until the re-branding has been completed and do al the 301's in one go?, or should I try and do 301's as i go along? Kind Regards
Technical SEO | | Paul780