问题描述
我上传了我的Symfony2项目服务器树林。主要的页面加载,但所有环节都坏了。我尝试添加app.php的网址。它没有工作,但是:
我有像这样的路线:
www.something.com/app.php/something
我想他们是:
www.something.com/something。
我一直在读,我应该把一些重写规则上的.htaccess。
我发现这些规则,但他们似乎并没有工作:
< IfModule mod_rewrite.c>
RewriteEngine叙述上
的RewriteCond%{} REQUEST_FILENAME!-f
重写规则^(。*)$ app.php [QSA,L]
< / IfModule>
尝试在你的.htaccess文件(网页目录内):
< IfModule mod_rewrite.c>
选项+的FollowSymLinks
RewriteEngine叙述上
#明确禁止改写为前端控制器
重写规则^ app_dev.php - [L]
重写规则^ app.php - [L]
的RewriteCond%{} REQUEST_FILENAME!-f
#部署到生产环境之前更改如下
#RewriteRule ^(。*)$ /app.php [QSA,L]
重写规则^(。*)$ /app_dev.php [QSA,L]
< / IfModule>
I uploaded my symfony2 project to server grove. The main page loads, but all the links are broken. I tried adding app.php to the web address. It did work, but:
I have routes like this one:
www.something.com/app.php/something
I want them to be:
www.something.com/something.
I've been reading, and I should put some rewrite rules on the .htaccess.
I found these rules, but they don't seem to work:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>
Try this in your .htaccess file (inside the web directory):
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
# Explicitly disable rewriting for front controllers
RewriteRule ^app_dev.php - [L]
RewriteRule ^app.php - [L]
RewriteCond %{REQUEST_FILENAME} !-f
# Change below before deploying to production
#RewriteRule ^(.*)$ /app.php [QSA,L]
RewriteRule ^(.*)$ /app_dev.php [QSA,L]
</IfModule>
这篇关于Symfony2的重写规则的.htaccess app.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!