我有一个名为content的模块,它在app前端。当我转到 localhost:8080/frontend_dev.php/content
时,我看到页面显示没问题。但是没有 /frontend_dev.php
我就无法访问该页面。
有什么不对?这是我的前端settings.yml:
prod: .settings: no_script_name: true logging_enabled: false dev: .settings: error_reporting: web_debug: true cache: false no_script_name: false etag: false test: .settings: error_reporting: cache: false web_debug: false no_script_name: false etag: false all: .settings: # Form security secret (CSRF protection) csrf_secret: ecca0f5ffb475363f798d55871546583f60f971f # Output escaping settings escaping_strategy: true escaping_method: ESC_SPECIALCHARS # Enable the database manager use_database: true enable_modules: [default, sfGuardAuth]
我得到的是来自网络服务器的404。清除了symfony缓存,没有用。并做了一个chown -R username projectdirectory。
我的意思是 localhost:8080/module/action
,不适用于任何事情。但它在我运行symfony项目的另一台服务器上的工作原理就是这样。
编辑:
我还是symfony的新手。我设法进入了 localhost:8080/index.php/module/action
。但是如何从路由规则中删除index.php?感谢
由于
答案 0 :(得分:6)
听起来mod_rewrite
没有被启动,你启用它了吗?它甚至安装了吗?
您可以查看:
/your/path/to/httpd -M | grep rewrite
或者您可以删除<IfModule mod_rewrite.c></IfModule>
中重写规则周围的.htaccess
标记。执行此操作后,如果未安装和/或启用mod_rewrite,则会生成配置错误。
如果你安装了mod重写,那么确保可以在.htaccess
中使用它的指令。你的vhost(或httpd.conf)中应该有以下内容:
<Directory "/path/to/your/project/web">
AllowOverride All
# possibly other rules....
</Directory>