繁体   English   中英

重写规则不起作用

[英]Rewrite rule not working

我已经使用akrabat.com/zend-framework-tutorial/在Zend Framework中完成了第一步。 演示应用程序工作正常,但CSS。 我认为我的重写规则是错误的。 所有href看起来像:

  • /~cm/zf-tutorial/public/index.php/index/edit/id/1
  • /~cm/zf-tutorial/public/index.php/css/site.css

.htaccess是:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteBase /
RewriteRule !\.(js|ico|txt|gif|jpg|png|css)$ index.php

有人可以给我提示如何更改它吗?

我认为重写规则看起来不错。 几乎是ZF随附的产品。 您如何包含样式表? 您将它们放在哪里,index.php等在哪里?

假设您将应用程序的文档根目录定义为/ htdocs / zf-tutorial / public ,并且样式表位于/ htdocs / zf-tutorial / public / css中 ,那么您必须记住样式包含在/ css /中。 site.css

另外,您的href不应包含index.php,Apache的重写规则可以解决这一问题。 您的href看起来应该像这样:

  • / index / edit / id / 1
  • /css/site.css
  • /控制器/动作/参数列表

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM