1

I learn Symfony2 and i have: http://symfony.com/doc/current/quick_tour/the_big_picture.html

http://localhost/Symfony/web/app.php/demo/hello/Fabien

And if you use Apache with mod_rewrite enabled, you can even omit the app.php part of the URL:

http://localhost/Symfony/web/demo/hello/Fabien

Last but not least, on the production servers, you should point your web root directory to the web/ directory to secure your installation and have an even better looking URL:

http://localhost/demo/hello/Fabien

how can i make this in WAMP Server?

0

2 Answers 2

1

What you want to do is add a virtual host which points to the symfony application. You can do that by adding another virtual host with the following configuration:

<VirtualHost *:80>
    ServerName localhost

    # Basic stuff
    DocumentRoot "C:/path/to/symfony/web"
    DirectoryIndex app.php
    <Directory "C:/path/to/symfony/web">
        AllowOverride All
        Allow from All
    </Directory>
</VirtualHost>

Depending on your configuration, you either have a httpd-vhosts.conf within your apache/conf/extra folder where you can add the part or you can add it to the httpd.conf! Make also sure no other virtual host for localhost is defined.

1
  • serverfault.com may not be the best place to ask question regards sf2 and since there isn't yet any efficient way to receive support with symfony 2 I think the following proposal is a very good idea! - A new Q&A site for symfony2 - Please join & spread the word!
    – Xuni
    Nov 20, 2011 at 10:39
2

First you need to enable mod_rewrite in Xampp the way it says here. Then you need to set a mod_rewrite rule in the .htaccess of your application typically in the "web" folder. A rule to remove the app.php would be like this:

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

If you want to know more about URL Rewriting here is a nice tutorial.

1
  • thanks, but this is default in Symfony. how can i remove Symfony/web ?
    – Martin Jenseb
    Nov 10, 2011 at 18:13