0

I am trying to force redirect my non http and non www site to https with www.

My .htaccess file code is this

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Also the rewrite mode is enabled on the server and in apache2.conf file AllowOverride is set to ALL

But the redirect is not happening. Can any one tell me where i am doing wrong ?

mohit
  • 290
  • 1
  • 6
  • 19
  • Add some garbage characters on a line by itself in the ``.htaccess`` file. Does Apache then give an error? If it doesn't, for a start, the file isn't even being read. – Graham Dumpleton May 14 '17 at 05:01
  • @GrahamDumpleton yes, i get 500 internal error. That means the .htaccess is working. But the code i am using is correct – mohit May 14 '17 at 06:43
  • Check the perfect solution from the link on this link https://stackoverflow.com/a/51688946/4880531 – Abayomi Israel Aug 04 '18 at 19:33

0 Answers0