php - Config Symfony3 URL


I use a debian server and I want change my URLipAdresse:9999/app.php/register withisAdress/register.

I have succeed to remove the.../web/.... But not the.../app.php/...

I have a virtual host :

Listen ipAdress:9999

<VirtualHost ipAdress:9999>
        DocumentRoot "/var/www/SuperSwungBall/web"
        DirectoryIndex app.php

        <Directory "/var/www/SuperSwungBall/web">
                AllowOverride All
                Allow from All

And a .htaccess in ~/web :

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

I have also tried with the default symfony ~/web/.htaccess . But, it doesn't work.

Thanks !




This article describes a couple of examples on how to configure your webserver to route all requests through app.php with clean URL's:

In your case your virtual host should look something like:

<VirtualHost *:9999>    
    DocumentRoot /var/www/SuperSwungBall/web
    <Directory /var/www/SuperSwungBall/web>
        AllowOverride None
        Order Allow,Deny
        Allow from All

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

    # uncomment the following lines if you install assets as symlinks
    # or run into problems when compiling LESS/Sass/CoffeScript assets
    # <Directory /var/www/project>
    #     Options FollowSymlinks
    # </Directory>

    <Directory /var/www/SuperSwungBall/web/bundles>
        <IfModule mod_rewrite.c>
            RewriteEngine Off
    ErrorLog /var/log/apache2/project_error.log
    CustomLog /var/log/apache2/project_access.log combined

People are also looking for solutions to the problem: php - How to select username in a given query in Joomla?


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.