Symfony2 - redirect /web directory to root

前端 未结 1 1058
夕颜
夕颜 2021-02-14 15:21

I\'ve got a duplicate content problem with my Symfony2 projet. The following urls gives the same content :

www.mywebsite.com/web/page and www.mywebsi

相关标签:
1条回答
  • 2021-02-14 15:57

    In the htaccess file in your web directory (the /web/.htaccess file), add these rules right beneath the RewriteEngine On:

    RewriteCond %{THE_REQUEST} ^(GET|HEAD)\ /web/
    RewriteRule ^(.*)$ /$1 [L,R=301]
    

    This redirects all direct access to the web directory to the root.

    0 讨论(0)
提交回复
热议问题