簡體   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