0

I want to remove "web" in URL. For example, I request such as the bottom URL.

http://localhost/symfony/web/mypage

But, I want to request such as the bottom URL.

http://localhost/symfony/mypage

So, I create .htaccess in document root and write settings.

<IfModule mod_rewrite.c>
  Options +FollowSymlinks
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-f

  RewriteRule ^symfony/(.*)$ symfony/web/$1 [L]
</IfModule>

And I got 404 error. This error messges appear in app/log/prod.log.

[2015-04-27 15:19:09] request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET /symfony/mypage/"" at /home/foobar/public_html/symfony/app/cache/prod/classes.php line 1885 {"exception":"[object] (Symfony\Component\HttpKernel\Exception\NotFoundHttpException(code: 0): No route found for \"GET /symfony/mypage/\" at /home/foobar/public_html/symfony/app/cache/prod/classes.php:1885, Symfony\Component\Routing\Exception\ResourceNotFoundException(code: 0): at /home/foobar/public_html/symfony/app/cache/prod/appProdUrlMatcher.php:781)"} []

How to remove "web" in url on Symfony2 ?

2
  • 1
    Just install symfony on top of document root, then rename web to symfony. Commented Apr 27, 2015 at 7:01
  • see Remove web/app_dev.php/ from url Commented Apr 27, 2015 at 8:06

1 Answer 1

0

You should configure a virtual host that point to /web directory if you use symfony 2.6 you should not have this kind of probleme because it cames with it's own server that point to the web directory by default.

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.