Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

migrated from stackoverflow.com Nov 16 '11 at 0:26

This question came from our site for professional and enthusiast programmers.

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer
    
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 '11 at 10:39

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.

share|improve this answer
    
thanks, but this is default in Symfony. how can i remove Symfony/web ? –  Martin Jenseb Nov 10 '11 at 18:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.