This is my scenario:
- I have my Symfony 3.3 app deployed at my domain with cpanel in a dedicated hosting in Godaddy.
- My document root is not public_html, it is a subfolder in public_html
- With http I can access normally to my website
- When I installed the ssl certificate in cpanel successfully and then I update my .htaccess under web folder to redirect to https, the site was redirected to public_html folder, not to public_html/subfolder/web, just like it was occur with http normally.
Please, some one can help me with this problem?
I hope that change my Symfony web folder to public_html folder are not the only solution.
UPDATE 1
My .htaccess file
DirectoryIndex app.php
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
# start https
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# end https
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteCond %{HTTP:Authorization} .
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^app.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
RewriteRule ^ %{ENV:BASE}/app.php [L]
</IfModule>
<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
RedirectMatch 302 ^/$ /app.php/
</IfModule>
</IfModule>
UPDATE 2
I found the problem and the solution, that´s why I changed the title of the question, because the problem was not with Symfony, was with Apache virtual host configuration.
2
Answers
One of the comments of Ramazan give me a new idea to search the solution. Well, I found it here To deploy my site in a subfolder into public_html I needed to change the virtual host configuration, but, I only modified the main file, not the _SSL config file. Then, the solution in this link is worked for me.
You can solve this problem by using security configuration. Here is a example https://symfony.com/doc/current/security/force_https.html
or routing
https://symfony.com/doc/current/routing/scheme.html