0

I have a site in which https works well, but I had to feed the 's' in the https. I was trying to force all http request to https. I tried many things with my .htaccess like this, and many similar. Finally I did something on my vhosts file which sits on my /etc/apache/sites-enabled/001-mysite.conf.

The changes I made was this

<VirtualHost *:80>
  ServerName www.example.com
  Redirect "/" "https://www.example.com/"
</VirtualHost>

and it works just as I wanted. Now what is wrong with my .htaccess. Is it not working because any change I make does not seem make any difference. My .htaccess is located in the root directory of my site. I am running my site from an Amazon Web Services EC2 ubuntu 14.04 VM instance.

  • If this is working OK in your server config / VirtualHost then you should stop there - job done. If any change you make (including typing "nonsense") to `.htaccess` "does not seem make any difference" then it sounds like per-directory `.htaccess` files are not enabled (which in many respects is a good thing). `.htaccess` files need to be specifically enabled in your server config. eg. `AllowOverride FileInfo` (or `AllowOverride All`). – MrWhite Oct 19 '16 at 16:55
  • 1
    Possible duplicate of [Redirect, Change URLs or Redirect HTTP to HTTPS in Apache - Everything You Ever Wanted to Know About Mod\_Rewrite Rules but Were Afraid to Ask](http://serverfault.com/questions/214512/redirect-change-urls-or-redirect-http-to-https-in-apache-everything-you-ever) – Tero Kilkanen Oct 19 '16 at 19:21
  • @TeroKilkanen Sorry if I wasn't clear, I meant more like [How to debug .htaccess RewriteRule not working][1] [1]: http://stackoverflow.com/questions/9234289/how-to-debug-htaccess-rewriterule-not-working – Sanjok Gurung Oct 20 '16 at 12:54

0 Answers0