我想使用 mod_rewrite。我在 /var/www/.htaccess 这个代码
<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/..
/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