简体   繁体   中英

Symfony2 the good .htaccess for the prod

I use this .htaccess for my symfony2 project :

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ web/$1 [QSA,L]

But with this .htaccess I've duplicate content: http://domain/page == http://domain/web/page

I can access to my website with / and /web/ . How to redirect all /web/* to /* ?

When I put DocumentRoot /data/sites/web/medesthebe/www/web before RewriteEngine On that's give me an error 500.

PS : It's a basic hosting not a VPS or dedicated server. I've not access to vhosts Thx

只需在您的htaccess中设置DocumentRoot即可;

DocumentRoot /var/www/symfony_project/web

You usually can change the root path of the domain in the hosting management panel. Instead of setting it directly to the whatever www folder, use the web subfolder.

It worked for me instead of creating complex rules in the DOCUMENT_ROOT/.htaccess to redirect everything to /web.

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