0

I want to access http://localhost/myproject/web/app_dev.php in symfony from my http://localhost/myproject. I have it up and running for app.php:

# Works if I call http://localhost/myproject
<IfModule mod_rewrite.c>
   Options FollowSymLinks

   RewriteBase /myproject/
   RewriteEngine On
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteRule ^(.*)$ web/app.php [QSA,L]
</IfModule>

The same fails with app_dev.php. I thought, that the routing.yml get loaded anyway, since I do not have an routing_dev.yml, it should work out of the box - as I thought. But it does not:

# Works not if I call http://localhost/myproject
# Error Message: No route found for "GET /myproject/"

<IfModule mod_rewrite.c>
    Options FollowSymLinks

    RewriteBase /myproject/
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ web/app_dev.php [QSA,L]
</IfModule>

Why's that?

EDIT:

http://localhost/myproject/web/app_dev.php does work!

EDIT II: When using the not working .htaccess the images from symfonys error page are fail to load, too.

hakre
  • 193,403
  • 52
  • 435
  • 836
shredding
  • 5,374
  • 3
  • 46
  • 77

1 Answers1

2

If you are on localhost then you should create a virtual host say localhost.myproject and set web directory as DocumentRoot. If you are in shared hosting then check my answer here to get working asset links.

Community
  • 1
  • 1
Mun Mun Das
  • 14,992
  • 2
  • 44
  • 43