In the apps/frontend/config/settings.yml
file, you can delete the application name from your uri by activing the no_script_name
option.
This option is enabled for the first generated application (most often, the frontend), but not for the others.
Because without the application name, symfony wouldn't know which one to use when the applications share the same domain.
We have to find an other way to let symfony know which application to use.
A solution can be to use several domains :
Personnally, I prefer use some sub domains for each application :
You juste have to add a new virtual host in httpd.conf
:
<VirtualHost *:80>
ServerName admin.my-app.com
DirectoryIndex backend.php
DocumentRoot "/path/to/the/web/directory"
<Directory "/path/to/the/web/directory">
AllowOverride All
Allow from All
</Directory>
Alias /sf /path/to/the/symfony/data/web/sf
<Directory "/path/to/the/symfony/data/web/sf">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
In that case, you probably can't access to the httpd.conf
.
So let's play with the /web/.htaccess
. Just after :
<IfModule mod_rewrite.c>
RewriteEngine On
Add the following lines:
# The admin subdomain returns to the backend
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_HOST} ^admin\.my-app\..*
RewriteRule ^(.*)$ backend.php [QSA,L]
settings.yml
prod:
.settings:
no_script_name: true
Don't forget to clear the cache.
php symfony cc
Powered by jQuery UI and symfony. Symfony Check
The content this site is published under a Creative Commons License. Some parts of the content are a remix of the official symfony documentation.