I am trying to deploy a symfony application to a subfolder of my root directory and I am trying to figure out how to do this correctly. I will just explain the situation. In my root directory there is a subfolder named /private that contains the htaccess file, which is redirected to /private/web/current/ (I am deploying using capistrano).
Folder structure
- ROOT/ ---- private/ ------- .htaccess (1) ------- current/ ----------- web/ ------------- app.php ------------- .htaccess (2)
htaccess (1)
RewriteEngine On RewriteRule ^$ /private/current/web/ [L]
htaccess (2)
DirectoryIndex app.php <IfModule mod_rewrite.c> RewriteEngine On 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}/$2 [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>
Result
When I request /private , I get Symfony error :
No route found for "GET /private/"
When I request /private/login AND /login , I get a browser error :
Not Found The requested URL /private/login was not found on this server.
Symfony now performs routing from the root directory, but the root for the symfony project is actually / private. I am a noob in deployment and htaccess rules, so is there anyone who can help me?
early.
source share