3

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

2
  • Can you post your vhost config and .htaccess? Commented May 29, 2013 at 13:20
  • i have posted my vhost and .htacccess settings please check it Commented May 30, 2013 at 2:47

1 Answer 1

8

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.