SlimenTN
SlimenTN

Reputation: 3564

Symfony2 redirect from http to https

I know guys this question has been asked many times but believe me I have tried all the solutions in the other questions without any results.
As mentioned in the title I want all my http requests to be converted into https requests, and I want to use .htaccess file to do this so this is what I have tried so far:

#https redirect
RewriteEngine On
RewriteCond %{HTTPS} !=on    
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]    
RewriteCond %{REQUEST_FILENAME} !-f   
RewriteRule ^(.*)$ app.php [QSA,L]

But this gives me nothing my site is not being redirected from example.com to https://example.com
What am I missing here ?

Upvotes: 0

Views: 2712

Answers (1)

arkascha
arkascha

Reputation: 42935

As worked out in a lengthy communication via chat the issue was that the redirection rules were coded after (below) other internal redirection rules, so never got applied.

Moving the http to https redirection rules up solved the issue.

Upvotes: 3

Related Questions