How to force a website to redirect from http to https using htaccess

Here am going to explain you how force a website redirect from http to https using htaccess files, we all know htaccess is the configuration files normally using in Apache web server to specify redirect rules.we can write our own URL redirect rules and based on we can change the entire website url structure.

Most common use of URL redirects for SEO purpose and better page readability/simplicity, we have lots of rule for redirecting here am going to explain you reule to redirect from http to https using htaccess files

See below force a website redirect from http to https using htaccess
This is full .htaccess to files redirect from http to https

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?tutorialshore\.com
RewriteRule ^(.*)$ https://www.tutorialshore.com/$1 [R,L]

Step 1

First you have to activate RewriteEngine

RewriteEngine On

Step 2

Check if the browser is requesting by http

RewriteCond %{HTTP_HOST} ^(www\.)?tutorialshore\.com

Step 3

if the browser is requesting by http then force to redirect to https

RewriteRule ^(.*)$ https://www.tutorialshore.com/$1 [R,L]


How to force website redirect from http to https using htaccess

why google shows the wrong title for my website

Nowadays many of the website show different title character in google search page ,this is actually done by the hackers, the will replace our original title with Japanese ,Slavic languages, Indo-European languages, East Slavic languages, Balto-Slavic languages any of the languages with our website title this is why google shows the wrong title for my website. Here am going to explain how to remove that hack or spammers and bring back our current title to google search result page.

See below Images google shows the wrong title for my website

why google shows the wrong title for my website

How to remove wrong title for my website

Step 1
Open google and search

site:tutorialshore.com japan **replace tutorialshore.com with yourdomain.com

site:tutorialshore.com Slavic

open the pages code, that listing in the google search result and remove any unwanted code if their that may be done my hackers

Step 2

Open your sitemap.xml page and double confirm all the URL listed in the site map are correct URL in the website, if you find anything regenerate sitemap and resubmit to google webmaster

Step 3

Sort Files by date of modified and find out any new files update without your permission

Step 4

check file permission if any having 444 permission delete that files and upload the same files from your backup.

Step 5

Open google webmaster account

report the hacked pages and remove it with the help of google webmaster

Step 6

Resubmit Sitemap and Recrawl

Open Crawl => Fetch as google =>Fetch and render

See in picture

why google shows the wrong title for my website