简体   繁体   中英

htaccess symfony2 redirect to web directory

I've just published my symfony proyect, but the url is http://url.com/web/ . I want to change my .htaccess to point to web directory . So, the url I want it to be like http://url.com/ . I've tried to change my .htaccess but I have not been successful.

my project is in a shared host and i can't create a virtual host. I used this .htaccess file in symfony root and works.

<IfModule mod_rewrite.c>
    Options +FollowSymlinks
    RewriteEngine On

    # Explicitly disable rewriting for front controllers
    RewriteRule ^/web/app_dev.php - [L]
    RewriteRule ^/web/app.php - [L]

    # Fix the bundles folder
    RewriteRule ^bundles/(.*)$ /web/bundles/$1  [QSA,L]

    # Fix the assets folder
    RewriteRule ^assets/(.*)$ /web/assets/$1  [QSA,L]

    RewriteCond %{REQUEST_FILENAME} !-f
    # Change below before deploying to production
    #RewriteRule ^(.*)$ /web/app.php [QSA,L]
    RewriteRule ^(.*)$ /web/app_dev.php [QSA,L]
</IfModule>

https://undebugable.wordpress.com/2014/11/12/symfony2-htaccess-to-redirect-request-from-web-to/

Please read that page and look the Apache configurations.

http://symfony.com/doc/current/setup/web_server_configuration.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM