Moz Q&A is closed.
After more than 13 years, and tens of thousands of questions, Moz Q&A closed on 12th December 2024. Whilst we’re not completely removing the content - many posts will still be possible to view - we have locked both new posts and new replies. More details here.
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 -
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 -
Best proxy service to browse the Google from different countries to check the ranking
Hi Moz community, We need to check our website/pages rankings for random keywords at random timings in different countries. Beside checking in search console, we would like to check in browser. But Google now is not allowing us to browse the results of other country. I would like to use best proxy service to browse Google from different location to check how our pages are ranking & fluctuating. Please suggest on this. Thanks
SERP Trends | | vtmoz0 -
Search results vary in chrome vs other browsers even in Incognito mode: Google's stand?
Hi all, We use incognito mode or private browsing to check the Actual results which are not impacted by previous history, location (sometimes), etc. Even we browse this way, we can see the different search results. Why would this happen? What's Google's stand on this? What is the actual way to browse to get the unbiased results for certain search queries? I have experienced that Chrome will rank our own websites bit higher compared to the other browsers even in incognito mode. Thanks
SERP Trends | | vtmoz1 -
URL Parameter for Limiting Results
We have a category page that lists products. We have parameters and the default value is to limit the page to display 9 products. If the user wishes, they can view 15 products or 30 products on the same page. The parameter is ?limit=9 or ?limit=15 and so on. Google is recognizing this as duplicate meta tags and meta descriptions via HTML Suggestions. I have a couple questions. 1. What should be my goal? Is my goal to have Google crawl the page with 9 items or crawl the page with all items in the category? In Search Console, the first part of setting up a URL parameter says "Does this parameter change page content seen by the user?". In my opinion, I think the answer is Yes. Then, when I select how the parameter affects page content, I assume I'd choose Narrows because it's either narrowing or expanding the number of items displayed on the page. 2. When setting up my URL Parameters in Search Console, do I want to select Every URL or just let Googlebot decide? I'm torn because when I read about Every URL, it says this setting could result in Googlebot unnecessarily crawling duplicate content on your site (it's already doing that). When reading further, I begin to second guess the Narrowing option. Now I'm at a loss on what to do. Any advice or suggestions will be helpful! Thanks.
SERP Trends | | dkeipper0 -
Ways to fetch search analytics - historical search query data from Google Search Console
Is there any way to fetch all historical search query data from Google Search Console ? Google allows us to view only 90 days report at the maximum. Does integrating google search console with google analytics tool solve this problem ?
SERP Trends | | NortonSupportSEO0 -
How create product category in Google Analytics?
Hi, I have a lot of product in my GA ecommerce. Does anyone how I can split my product by product categories in Analytics? E.g. Category: Blue cars, category: Yellow cars ...
SERP Trends | | Tormar0 -
Create original content or Copy from several sources?
I own a site that that has about 15,000 pages that need some description content. I plan to hire someone to retrieve or create content for each of these pages on my site. each page needs about 500 words. I was thinking that there is probably three ways i can go about this. If I hire someone cheap I can probably have them copy data from about 20 different sites. using about 5 sources for each page description. I can hire someone that has some experience writing english content, and have them go to a few sites and then in their own words summarize the description on my site. I can hire a great content writer, have them do research on each page, and create completely unique content. I probably will do some combination of these 3 things. (great content writer on a few pages, since thats all i can afford to do) and the rest do the cheaper route. Is copying sentences from multiple sources a good idea? or does the content really need to be original?
SERP Trends | | moneymm220