我想用mod_rewrite。我在這/var/www/.htaccess代碼Symfony mod_rewrite只有主路由工作
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
#AllowOverride All
#Allow from All
#RewriteBase /WorldClock
#RewriteBase WorldClock/web/app.php
# Explicitly disable rewriting for front controllers
RewriteRule ^/web/app_dev.php - [L]
RewriteRule ^/web/app.php - [L]
# Fix the bundles folder
#RewriteRule ^(.*)$ WorldClock/web/app.php/test [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
# Change below before deploying to production
RewriteRule ^(.*)$ WorldClock/web/app.php [QSA,L]
#RewriteRule ^(.*)$ WorldClock/web/app_dev.php [QSA,L]
</IfModule>
如果行是註釋,意味着它做出內部服務器錯誤 我的項目是在/var/www/WorldClock/..
文件夾CSS | JS | IMG我轉移到/var/www
如果我試圖進入localhost
那麼它工作正常。但是,如果我在鏈接點擊此網址這樣http://localhost/info/12
然後我得到
Not Found The requested URL /info.xml/12 was not found on this server.
一切正常,沒有的.htaccess。 mod_rewrite在phpinfo()中打開;我使用symfony2和Ubuntu