简体   繁体   English

htaccess symfony2重定向到Web目录

[英]htaccess symfony2 redirect to web directory

I've just published my symfony proyect, but the url is http://url.com/web/ . 我刚刚发布了我的symfony proyect,但是URL是http://url.com/web/ I want to change my .htaccess to point to web directory . 我想更改.htaccess指向web directory So, the url I want it to be like http://url.com/ . 因此,我希望它的网址像http://url.com/ I've tried to change my .htaccess but I have not been successful. 我试图更改我的.htaccess但未成功。

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. 我在symfony根目录中使用了该.htaccess文件并可以工作。

<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/ https://undebugable.wordpress.com/2014/11/12/symfony2-htaccess-to-redirect-request-from-web-to/

Please read that page and look the Apache configurations. 请阅读该页面并查看Apache配置。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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