Reputation: 5591
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.
Upvotes: 0
Views: 2618
Reputation: 15002
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.
Upvotes: 2