2

I have bought SSL certificate from Namecheap and installed on Hostgator c-panel. Some organic search traffic pages are not redirecting on https. Https is not showing in Google Search. My .htaccess file is like as

# Use PHP55
AddHandler application/x-httpd-php55 .php
<IfModule mod_suphp.c>
suPHP_ConfigPath /opt/php55/lib
</IfModule>


# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
# Always use https for secure connections
# Replace 'www.mydomain.in' with your domain name
# (as it appears on your SSL certificate)
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.mydomain.in/$1 [R=301,L]
  • 1
    Silly question but did you replace mydomain.in to your domain? and can you confirm that within WordPress you have changed the site address from HTTP to HTTPS? – Simon Hayter Dec 31 '17 at 12:21
  • i have done this replacement but it is not working – user76743 Jan 2 '18 at 11:01
0

You will obviously need to make sure you have done the two things that @Simon mentioned in comments. Namely to use your actual domain in the RewriteRule directive and to change the WordPress/Site address in the admin section.

However, you have put your redirect code in .htaccess in the wrong place! This is a show stopper. By placing the mod_rewrite directives at the end of the file, after the WordPress front-controller, they will never get executed (at least not for any WordPress URLs). So, the code you posted won't actually be doing anything!

You need to place the redirect code before the WordPress front-controller. ie. Before the # BEGIN WordPress section.

  • 1
    Thank you so much. I have done and now it is working nicely. – user76743 Jan 8 '18 at 5:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.