0

I tried adding this on the .htaccess file on the root of lamp server ( on Amazon EC2 Ubuntu Instance )

<VirtualHost *:80>
...
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI}
...
</VirtualHost>

And ended up with this error

Server error!

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.

If you think this is a server error, please contact the webmaster.

Error 500

xx.x.xxx.xxx Apache/2.4.10 (Unix) OpenSSL/1.0.1i PHP/5.5.15 mod_perl/2.0.8-dev Perl/v5.16.3

Also tried finding /etc/apache2/mods-enabled directory to write a rewrite configuration, but there is no such directory on Ubuntu 14.04

Someone knows who to enable the rewrite module?

vivekrajns
  • 49
  • 2
  • 8
  • if you are adding section in .htaccess then it should fail. Directives don't live in .htaccess but in configuration files (.conf). If you want to put the rewrite directive in .htaccess then you should do that without container. – smozgur Jan 22 '16 at 22:27
  • @smozgur that worked and the redirection is perfect now, but still ending up with an error "Too many redirects occurred trying to open “https://xx.x.xxx.xxx/“. This might occur if you open a page that is redirected to open another page which then is redirected to open the original page." – vivekrajns Jan 22 '16 at 23:08
  • Revise your https redirection rule, it is causing redirection due to wrong configuration: Good sample here: http://stackoverflow.com/questions/13977851/htaccess-redirect-to-https-www – smozgur Jan 22 '16 at 23:15
  • @smozgur works like a charm! Thanks a lot! – vivekrajns Jan 22 '16 at 23:26

0 Answers0