i have renamed app.php to index.php where the routing.yml contains the following routes index:
pattern: /
defaults: { _controller:RepairLoginBundle:home:home}
login:
pattern: /login
defaults: { _controller:RepairLoginBundle:Login:login}
when i use /
it is displaying my home page of project but when i click on login or register buuton it generating the url /login and displaying
The requested URL /rpair/login/ was not found on this server.
i want to create a default index page in symfony2 as soon as user clicks /.
This is my vhost settings
NameVirtualHost 10.70.10.56
ServerName repair.com
DocumentRoot "/var/www/repair"
<Directory "/var/www/repair">
DirectoryIndex app.php
AllowOverride All
Order allow,deny
Allow from all
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
RedirectMatch permanent ^/app\.php/(.*) /$1
</Directory>
.htaccess: Options +FollowSymlinks RewriteEngine On
# Explicitly disable rewriting for front controllers
RewriteRule ^app_dev.php - [L]
RewriteRule ^app.php - [L]
RewriteCond %{REQUEST_FILENAME} !-f
# Change below before deploying to production
#RewriteRule ^(.*)$ app.php [QSA,L]
RewriteRule ^(.*)$ app_dev.php [QSA,L]
RedirectMatch permanent ^/app.php/(.*) /$1
If you rename app.php to index.php you will also need change (in your web/.htaccess file):
RewriteRule ^(.*)$ app.php [QSA,L]
into:
RewriteRule ^(.*)$ index.php [QSA,L]
But maybe it's easier (if you have access to appropraite configuration) change your vhost settings. Just add app.php to DirectoryIndex directive.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With