how delete web from Symfony URL

1- httpd.conf

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

 

2- By .httaccess file

  1. having access at least to the web root of your site. Usually on the control panel of your web hosting space you can find from which you can upload your files (or if you have the access credentials you can install and use a Free FTP client like Filezilla).
  2. checking if you have the mod_rewrite module installed and enabled in Apache looking the phpinfo() under “apache2handler” —> “Loaded Modules” directory (you should have that possibility directly through the control panel).

After these checks you have to:

NOTE: Symfony2 already comes with an .htaccess file stored in the default web directory but if you don’t know what are you doing it’s better to replace the directives containet within the “IfModule mod_rewrite.c” with those shown below.

  1. Use the native Symfony2 .htaccess or create a new one file with the .htaccess extension and copy/paste inside these directives to hide app.php in production (not on localhost):
    <IfModule mod_rewrite.c>
        RewriteEngine On  
        RewriteCond %{ENV:REDIRECT_STATUS} ^$  
        RewriteRule ^app\.php(/(.*)|$) %{CONTEXT_PREFIX}/$2 [R=301,L]
        RewriteRule .? - [L]
        RewriteCond %{REQUEST_FILENAME} -f
        RewriteRule ^(.*)$ app.php [QSA,L]
        RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
        RewriteRule ^(.*) - [E=BASE:%1]    
        RewriteRule .? %{ENV:BASE}app.php [L]
    </IfModule>
    
    # and from the symfony's original
    <IfModule !mod_rewrite.c>
        <IfModule mod_alias.c>
            # When mod_rewrite is not available, we instruct a temporary redirect of
            # the start page to the front controller explicitly so that the website
            # and the generated links can still be used.
        RedirectMatch 302 ^/$ /app.php/
            # RedirectTemp cannot be used instead
        </IfModule>
    </IfModule>

    To apply the modifications you need to restart Apache (also this is usually did on the control panel of your web space).