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
-
Redirects Advice
We have many redirects in place - and sometimes 2 in a chain. Is there a recommended time you should have a redirect in place?
Technical SEO | | Caroline_Ardmoor0 -
Can i do 301 redirect
So this is what im doing, 301 redirect to my site/allen-webdesign points to main domain Allen is the city i have a page called local-webdesign with all the cities. Will this improve my ranking or should i stop?
Technical SEO | | jsdfw0 -
Moving from http to https - what do I need to do in Google Search Console?
Hi all, I have moved my site from http to https. I current have two profiles in Google Search Console: http://mysite.com
Technical SEO | | Bee159
http://www.mysite.com Do I need to set up the same but with https and if so, what do I then do with the http profiles? Do I delete them? Or just remove the sitemaps? Confused.0 -
Mass HTTP to HTTPs move
Hi, As as part of an on-site SEO optimisation process, we've identified moving over from http to https - this is also in part to ensure our on-site forms are secure. In our industry our website has a high traffic volume (top 2 in the industry), we are concerned what impact the 301-redirecting from http to https would have on our organic traffic, both in terms of how Google would react to this mass-301 redirect plus the loss of 'search value' of inbound links. Privacy issues aside, would the minor quality-signal improvement be worth the move? Anyone have experience with such a move - was the outcome positive? Many thanks, Jason
Technical SEO | | Clickmetrics0 -
Should we handle this redirect differently?
So our question is should we handle page redirection/rewriting in php or in .htaccess (with a specific problem we are running into outlined below). We have an ecommerce store in a subfolder of our site (example.com/store/). In the next folder down we have a group of widgets(www.example.com/store/widget-group1). Recently we put a .htaccess redirect in the top level folder (example.com/store/.htaccess), in order to re-write some URL’s and also 301 a page to another page. This seems to be negatively affecting our /widgets-group1/ subfolder however (organic traffic to example.com/store/widget-group1) took a nose dive 3 days after putting the .htaccess redirect in place on the /store/ folder and it has not recovered 8 days later). *Nothing appears outwardly wrong with the current setup to the eye when viewing the pages or requesting as googlebot (the only issue being the nose dive in organic traffic lol) *both subfolders are setup in apache config file to allow local overrides of .htaccess as follows: <directory store="" widget-group1="">Options -Indexes FollowSymLinks -MultiViews
Technical SEO | | altecdesign
AllowOverride All
Order allow,deny
allow from all</directory> <directory store="">Options -Indexes FollowSymLinks -MultiViews
AllowOverride All
Order allow,deny
allow from all</directory>0 -
Domain Authority why is change
Hey seomoz friends!
Technical SEO | | petrospan
I have a question and if you have some links to read about it, bring it on!! What variables changes that measurement?0 -
Another http vs https Question?
Is it better to keep the Transaction/ Payment pages on a commercial website as the only secure ones (https) and remainder of website as http? Or is it better to have all the commercial website as secure (https)?
Technical SEO | | sherohass0 -
Redirecting According to the occasion
We have loads of different departments that relate to specific occasions (e.g. Christmas, mothers day, father day etc), they all have good PR and inbound links etc and most of them rank well for the specific occasion. What I was thinking is that I could redirect all of the occasions that aren’t in use and send the traffic to the valid occasion live at the moment. So I would 301 all the Christmas pages to our valentine’s day main page. Then once valentines is gone I will redirect Christmas and valentines to the mothers day main page and so on. So this would be constantly switching as different occasions come along. Can you see any possible negative problems? Is there any chance that if I redirect Christmas for example, and then when Christmas comes we remove the redirect, could it harm the Christmas page?
Technical SEO | | steliosp210