302 redirect on http but not on https
-
Hi
I have noticed using screaming frog that 302 redirect is in place but when checking the HTTACESS there no such thing in place.
If I run a scan with: http://www.redirect-checker.org/index.php doing a test with: https://www. everything seems ok but then when I do: http://www. There is a 302 in place and seem to understand why.
I have analysed the Httacess file and cant seem to locate anything that refers to the 302 any advise or previous experience would be great.
Thanks
E -
you're running Apache tomcat right?
301 Redirect URLs.
Redirect 301 /holidays/about-direct-traveller/british-travel-awards.asp /directtraveller/awards
Redirect 301 /directtraveller/holidays/about-direct-traveller/british-travel-awards.asp /directtraveller/awardsI am guessing this simply from you having this port open and having no issues with HTaccess 8443 is the default port of tomcat with ssl
-
Johnson I agree thumbs up with Nginx could definitely be a as reverse proxy. the best way to tell would be to scan the ports but I will allow him to do that.
I agree with you as well on the 302 issue
He has to redirect using a 301 instead of a 302 from
https://www.directtraveller.com/holidays/about-direct-traveller/british-travel-awards.asp
https://www.directtraveller.com/awards
I bet there are a few other 302's in there if there are one however I'm speculating. Crawling the site withhttps://www.deepcrawl.com/ or http://www.screamingfrog.co.uk/seo-spider/ will show him any 302's as far as the best way to redirect I agree with you again it is based on what type of server he is using.If MS ASP
Ues
http://www.rapidtables.com/web/tools/redirect-generator.htm
http://www.rapidtables.com/web/dev/url-redirect.htm#asp-redirect
ASP redirect
old-page.asp:
<%@ Language="VBScript" %>
<%
' ASP permanent URL redirection
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://www.mydomain.com/new-page.html"
Response.End
%>http://ask.webatall.com/nginx/17733_nginx-redirect-http-to-https-and-non-www-to-ww.html
From feed the bot you can see your site is unfortunately using 302's maybe that's on purpose if not you should change it to 301's.
Final status code: 200
1 Redirect(s)
https://www.directtraveller.com/holidays/about-direct-traveller/british-travel-awards.asp
** 302 redirect**
https://www.directtraveller.com/awardsIf is is a Proxy
http://wiki.nginx.org/HttpProxyModule#proxy_redirect
http://wiki.nginx.org/Pitfalls#Using_If
PS
I would remove the nofollow on these links. Google likes TOS and privacy policies
Nofollow links
3 nofollow links
- /terms-and-conditions
- /resources
- /privacy-policy checked using http://www.feedthebot.com/tools/
all the best,
Tom
-
We have a redirect from HTTP to HTTPS and then have the following redirect on the httaccess file:
#Redirect /directtraveller/holidays/about-direct-traveller/british-travel-awards.asp /directtraveller/awards
Redirect /holidays/about-direct-traveller/british-travel-awards.asp /directtraveller/awards
-
Not necessarily. He could be using Nginx as reverse proxy.
He already said the http to https is working fine with my suggestion. The problem is the redirect from one URL to another which what I gave him for the .htaccess doesn't address at all.
ie.
https://www.directtraveller.com/holidays/about-direct-traveller/british-travel-awards.asp
to
https://www.directtraveller.com/awards -
The reason why the HTaccess file is not working for you is because you're running a server on Nginx instead of Apache's .htaccess your server uses a "nginx config" this is why .htaccess will not work properly. this will also show you why you're still running a 302 redirect instead of a 301 redirect
https://www.digitalocean.com/community/questions/http-https-redirect-positive-ssl-on-nginx
for referencing these URLs below will tell you everything you need to know about your configuration and how to set it up. I've placed a lot of redirects below because there are so many different ways of doing this below the two URLs where it says I recommend using this is the configuration that should be default on your server in order to force SSL
http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#return
http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name
** I recommend using this to fix use this on your nginx config file**
_**`server { listen 80; server_name www.domain.com; return 301 https://$server_name$request_uri; } server { listen 443 ssl; server_name www.domain.com; [....] }`**_
might be easier this way
<code>server { listen 80; server_name my.domain.com; return 301 https://$server_name$request_uri; } server { listen 443 ssl; server_name my.domain.com; [....] }</code>
you are still putting out 302's I double checked your server
http://www.feedthebot.com/tools/headers/test.php
https://www.directtraveller.com/holidays/about-direct-traveller/british-travel-awards.asp
HTTP/1.1 **302 Found **
Server: nginx/1.6.0
Date: Sat, 11 Apr 2015 02:59:23 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: keep-alive
Location: https://www.directtraveller.com/awardsHeader transfer size: 199
http://www.directtraveller.com/holidays/about-direct-traveller/british-travel-awards.asp
301 Moved Permanently
| Status: | 301 Moved Permanently |
| Code: | 301 |
| Server: | nginx/1.6.0 |
| Date: | Sat, 11 Apr 2015 02:12:51 GMT |
| Content-Type: | text/html; charset=iso-8859-1 |
| Content-Length: | 370 |
| Connection: | close |
| Location: | https://www.directtraveller.com/holidays/about-direct-traveller/british-travel-awards.asp |https://www.directtraveller.com/holidays/about-direct-traveller/british-travel-awards.asp
302 Found
| Status: | 302 Found |
| Code: | 302 |
| Server: | nginx/1.6.0 |
| Date: | Sat, 11 Apr 2015 02:12:51 GMT |
| Content-Type: | text/html; charset=iso-8859-1 |
| Content-Length: | 296 |
| Connection: | close |
| Location: | https://www.directtraveller.com/awards|
| Status: | 200 OK |
| Code: | 200 |
| Server: | nginx/1.6.0 |
| Date: | Sat, 11 Apr 2015 02:12:52 GMT |
| Content-Type: | text/html |you can convert Htaccess to nginx using this tool http://winginx.com/en/htaccess
however I would force SSL instead of use a rewrite through the converter. The redirects below work but I would use the server-side redirect labeled use this
Check out Engine Yard for more redirects I have placed quite a few here
https://blog.engineyard.com/2011/useful-rewrites-for-nginx
this is a basic redirect you can put the port or each port in place.
server {
server_name example.com;
rewrite ^/(.*) https://example.com/$1 permanent;
}USE THIS
Redirect both, non-SSL and SSL to their www counterpart:
<code>**server { listen 80; listen 443 ssl; server_name directtraveller.com; return 301 $scheme://www.directtraveller.com$request_uri; }** server { listen 80; listen 443 ssl; server_name example.com; # rest goes here... }</code>
Add a www with this block
server {
listen 80;listen 443 ssl;
server_name directtraveller.com;
rewrite ^(.*)$ $scheme://www.directtraveller.com$1;
}(
)
Remove a www with this block instead
server {
listen 80;
server_name www.directtraveller.com;
rewrite ^(.*)$ $scheme://directtraveller.com$1;
}<code>rewrite ^(.*)$ https://$host$1 permanent; #3 rewrite ^ https://$host$request_uri permanent; #4 I**f you have any questions please feel free to ask I hope this is enough information and not overwhelming. If you feel overwhelmed simply use the very first config.** **Sincerely,** **Tom**</code>
-
What did you put to redirect the following:
https://www.directtraveller.com/holidays/about-direct-traveller/british-travel-awards.asp
to
https://www.directtraveller.com/awardsAs that is where the problem lies.
-
John threw that in and did a retest and is working now - you genius! Thanks
-
Hi Ram. If Jon's fix above doesn't work, you might want to post the link(s) you're testing with Screaming Frog so that people here can see what's going on and give you specific recommendations. It sounds like there's a 302 in place on the http version of your site, but people will need details to see where exactly. Cheers!
-
Try this in your .htaccess file:
RewriteCond %{HTTPS} off
First rewrite to HTTPS:
Don't put www. here. If it is already there it will be included, if not
the subsequent rule will catch it.
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Now, rewrite any request to the wrong domain to use www.
RewriteCond %{HTTP_HOST} !^www.
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [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
-
Getting indexed in Google Scholar
Hi all! We have a client who publishes scholarly research as a highly regarded non-profit. Their Publications aren't being indexed in Google Scholar 50% of the time and when they are, Google is pulling random stuff from a PDF vs. from the html page. Any advice on best practices is enormously appreciated
SERP Trends | | SimpleSearch1 -
Google showing different links in SERPs
Google search results are showing my site links in both URLs, "mydomain.com" and "https://mydomain.com". However the one with https is showing a favicon, and the other one is not. So i wanna keep the https one and remove the other one. I went to GSC to submit "mydomain.com" for removal and it said that URL will be deleted in ALL of its variations.So how do i delete the "mydomain.com" links? Should i just index the ones with https again? Would that work? Someone suggested me to do 301 redirect on all pages that are being displayed twice. But i am not sure if i need to do that since i am using squarespace, and both of the links lead to the same page?
SERP Trends | | winter22330 -
Has anyone used youramigo or know what Technics they use or alternative to YourAmigo
please share your experience. I don't know much about them and they approached me for our ecommerce site.
SERP Trends | | bizuhodge0 -
My website is being Cached with non-www and With WWW it is not indexed and cached
Hello Team, I had one question that my website is being indexed and cached with Non-www but with WWW it is not caching it is showing 404 error. Even each and every redirection is proper. Still it is showing an error. Can you please tell me what issue i had with my site?? Here is my links: https://webcache.googleusercontent.com/search?q=cache:nCH1DvhuQT8J:https://www.canvaschamp.com/+&cd=1&hl=en&ct=clnk&gl=usa
SERP Trends | | CommercePundit0 -
Getting indexed by Google scholar
Often my Google Scholar alerts result in exactly what I think they will: scholarly articles published in academic journals. However, today I got this completely non-scholarly article https://www.t-nation.com/training/the-exact-reps-that-make-you-grow and I have no idea why Google Scholar is indexing this site. I've read up on how to get indexed by Google Scholar, and this website doesn't seem to have the necessary requirements. I'm curious for anyone whose clients or industry need to get indexed by Google Scholar, what has worked for you?
SERP Trends | | newwhy2 -
What are the SEO challenges associated with private search engines, like DuckDuckGo?
I read recently that DuckDuckGo doubled in size in 2017. With their search engine, and other alternatives to Google, taking part of the search market away, how can SEO/Marketing/Web pros keep their websites optimized and get traffic from these private search engines? (Also, do any of you have experience with this? What portion of your search traffic is coming from private search engines?)
SERP Trends | | searchencrypt1 -
Is it bad for international SEO to redirect CcTLDs and install Google website translator plugin to the primary domain (UK)?
We've bought lots of country extensions, e.g. .es, .fr, .in, .me, etc. Rather than employing translators, will it be acceptable for SEO to install the google translate plugin to the site, and 301 redirect the country extensions to the .com address?
SERP Trends | | Tom_Rocks_Off0 -
Redirection of domain maybe affected by google
I have the domain clinicadentalbarcelona.net that in the past suffered a big traffic drop due to algorithm actualizations, but did not recieved any google letter. Althought the domain still is getting good rakings but has some toxic links I want to change the content to new domain clinicadentalbarcelona.es that as no historic or any linkbuilding my cuestion is if i can redireccion 301 of clinicadentalbarcelona.net (that has some page rank and links) to clinicadentalbarcelona.es/blog to prevent it from afecting the main root domain and to bring the page ranking and some links to a a web that as none. thank you what would you do in my case
SERP Trends | | maestrosonrisas0