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.

1 Answer 1

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.

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

1 Comment

I don't know why I haven't thought of that.

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.