How to change 302 redirect from http to https
-
Hi gang. Our site currently has a 302 redirect from the HTTP version of the homepage to the HTTPS version of the homepage. I understand this really should be changed to a 301 redirect but I'm having a little trouble figuring out exactly how this should be done.
Some places on the internet are telling me I can edit our htaccess file to specify the type of redirect, however our htaccess file seems to be missing some of the information in theirs.
Can anyone tell me what needs to be changed in the htaccess file - or if there's a simpler way to change the 302 to a 301? Many thanks
htaccess:
BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
END WordPress
EXPIRES CACHING
ExpiresActive On
ExpiresByType image/jpg "access plus 6 months"
ExpiresByType image/jpeg "access plus 6 months"
ExpiresByType image/gif "access plus 6 months"
ExpiresByType image/png "access plus 6 months"
ExpiresByType text/css "access plus 10 days"
ExpiresByType application/pdf "access plus 10 days"
ExpiresByType application/x-shockwave-flash "access plus 10 days"
ExpiresByType image/x-icon "access plus 6 months"
ExpiresDefault "access plus 2 days"
EXPIRES CACHING
-
Oop hi Ikkie, thanks for responding and sorry I didn't. Been one of those weeks!
When I tried this I got the following error: 'www.midlandnetworks.co.uk redirected you too many times.' Do I need to replace the first bit of my htaccess with that or just stick it on the end? Sticking on the end didn't seem too successful for me.
-
Hi David! Did Ikkie's response do the trick?
-
Hi Use the following
`# Redirect all "not correct" domain to www with https # (is not important if comes with or without https): RewriteCond %{HTTP_HOST} !^www.example.co.uk$ [NC] RewriteRule ^(.*)$ https://www.example.co.uk/$1 [L,R=301] # Redirect all non-ssl to ssl. RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://www.example.co.uk/$1 [R,L]`
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
-
Switching to HTTPS
Hey Moz Community! I am about to switch my website from http to https. I am wondering if I need to create a 301 redirect of every single page on my site, from the http address to the https url? Or if setting one master that redirects all traffic to the https version. Obviously I am concerned about losing rankings by switching. Code for https redirect of all RewriteEngine On
Technical SEO | | SeanConroy
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]1 -
Sub Domain Redirect
Hey Everyone, Here is the situation : Currently, a website's sub domain is being redirected to the main website home page. We're having issues getting the sub domain pages indexed. Just want to confirm that it is because of the redirect on the sub domain URL. Should we kill the sub domain redirect and set it up as it's own page? Will that solve the indexing issue for the sub domain pages. More explanation below: subdomain.domain.com currently redirects to domain.com We're having issues indexing pages belonging to the sub domain ( subdomain.url.com/page1 or subdomain.url.com/page2) Appreciate your input in advance. Cheers,
Technical SEO | | SEO5Team0 -
Redirect Question
We have a client that just did a redesign and development and the new design didn't really match their current structure. They said they didn't want to worry about matching site structure and never put any effort into SEO. Here is the situation: They had a blog located on a subdomain such as blog.domain.com - now there blog is located like domain.com/blog They want to create redirects for all the old the blog urls that used to be on the subdomain and not point to the domain.com/blog/post-name What is the best way of doing that - Through .htaccess?
Technical SEO | | Beardo0 -
302 to 301 redirect
Our site has quite a few 302 redirects that really ought to be 301's. Our IT department is really busy so the question is, given that the 302's have probably been in place for years, is it worth changing them to 301's now? Thanks
Technical SEO | | Houses0 -
Redirection Impact on SEO
Need help urgently. There is the situation [This is how is it working now]: 1. Have a global landing page [say when user types in www.mysite.com - takes user to the global landing page: [www.mysite.com/global/en.html]](http://www.mysite.com/global/en.html] ) 2. Users from this landing page can select a country on his/her choice and get redirected say: [www.mysite.com/us/en.html] Would like to change the functionality as below: 1. When user types in www.mysite.com 1a. Would find the location of the request based on GEO IP and if the request is coming from North America region then would redirect the users to: www.mysite.com/us/en.html 1b. If the request is from any other location/region then it would continue to work as it is currently working: take the user to the global landing page: www.mysite.com/global/en.html Would this change have any negative impact or not found by search engines from SEO perspective? If it does then what are the impacts and if does not then why not. If it does then what is the best possible way to address this request. Appriciate your help. Thanks, Koushik Roy
Technical SEO | | KoushikRoy0 -
Geo-Redirection
Our client has two almost identical sites targeting: Australia (www.mysite.com.au) Rest of World (www.mysite.com) Currently they have splash page on www.mysite.com asking users to select: Australia Rest of World (redirects to: www.mysite.com/home) I'm thinking they should get rid of slash page and simply auto detect if user on www.mysite.com is based in Australia and serve a message "Do you want to visit our .com.au site. It's not helped by the fact the .com site appears to get served ahead of .com.au iin australia as both sites are hosted in US. Looking to change this! Thanks in advance for your help!
Technical SEO | | steermoz70 -
Redirects
If I redirect page A to page B does page A need to exist before Google sees the redirect. Or can I just put up a redirect and delete page A. If the page doesn't need to exist: You have all your redirects in place for a website. You want this website to redirect to another website. You completely delete the website and put up the htaccess, there should be no problem with this, because the redirects are in place correct? Thanks
Technical SEO | | tylerfraser0 -
Compare URLs with 302 redirects
Hello I have a store which was developed in Magento. I have about 8300 errors like this: URL: http://www.theprinterdepo.com/catalog/product_compare/add/product/100/uenc/aHR0cDovL3d3dy50aGVwcmludGVyZGVwby5jb20vcHJpbnRlci1wYXJ0cy5odG1sP3A9NA,,/ 1 Warning 302 (Temporary Redirect) Found 3 days ago <dl> <dt>Redirects to</dt> <dt>http://goo.gl/XMaZg</dt> <dd>Description</dd> <dd>Using a 302 redirect will cause search engine crawlers to treat the redirect as temporary and not pass any link juice (ranking power). We highly recommend that you replace 302 redirects with 301 redirects.</dd> </dl> <a class="more expanded">Minimize</a> These URLs, are generated by magento by the COMPARE feature. In my store we bought an extension called SEO Enterprise Suite and I asked the developers(www.mageworx) about this error. Their answer is: Sorry for the late reply. Our extension adds NOINDEX,FOLLOW tag to compare and cookies pages so that they won't be indexed. I do not think that these redirects can hurt your SEO because these pages won't be indexed at all. The question is: What should I do? Is there anyway that SEOMOZ ignores these URLs? What should I do next, I just dont like to have that HIGH number of errors and warnings. Thank you
Technical SEO | | levalencia10