1

我在 Symfony 1.4 中创建了项目并在 FTP 上上传。如果我打开http://mysite.com/frontend_dev.php/loginhttp://mysite.com/frontend_dev.php/manage那么一切正常,但如果我打开http://mysite.com/loginhttp ://mysite.com/manage然后我有错误:

Not Found

The requested URL /login was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

为什么?我必须在 Symfony 或 Apache 中改变什么?

4

3 回答 3

3

frontend/config/setting.yml默认打开你有 4 个环境:

  • 产品
  • 开发者
  • 测试
  • 全部

添加此行

dev:
  .settings:
    no_script_name: true  # means you don't need the frontend_dev.php in url

然后清除缓存php symfony cc并测试。

另外,检查 " all" env 是否覆盖no_script_name:.

希望这些信息有用。

于 2012-05-21T15:27:59.053 回答
1

你有

no_script_name: true 

在您的 settings.yml 的 prod 部分中,并且:

RewriteRule ^(.*)$ index.php [QSA,L] 

在htaccess?

如果没有,那就用这个。它会起作用,只需根据您的需要更改 RewriteRule 即可。

于 2012-05-19T09:53:23.217 回答
1

还要确保在服务器上运行“symfony cc”。开发环境会在每次页面加载时清除缓存,但生产环境并非如此。如果你改变了路线,之后你总是需要一个“symfony cc”。

于 2012-05-20T15:41:10.883 回答