您好,我有以下适用于 IIS 6 的 isapi 重写规则。
它重写:
http://www.mysite.com/index.php?category=white-wine
到:
http://www.mysite.com/white-wine
.htaccess 内容:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ([^/]+)/?$ /?category=$1 [NC,QSA,L]
我现在正在尝试执行几乎相同的规则,但在更深的文件夹中。 编辑 该规则在站点根目录中的同一个 .htaccess 文件中我只是想将上述规则应用于位于名为 products 的根目录中的文件夹中的 index.php 文件。
我想重写:
http://www.mysite.com/product/index.php?product=the-chosen-product
到:
http://www.mysite.com/product/the-chosen-product
我试过这个:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ([^/]+)/product/?$ /product/?product=$1 [NC,QSA,L]
尽管我的 php 页面上有很多错误,但这不起作用:
Warning: require_once() [function.require-once]: URL file-access is disabled in the server configuration
Warning: require_once(http://www.mysite.com/myfolder/framework/library.php) [function.require-once]: failed to open stream: no suitable wrapper could be found
我最初在第一条规则中遇到了这些错误,但是现在它正在起作用,我想一定有可能以某种方式执行第二条规则?
另外我将如何更改它而不是显示:
http://www.mysite.com/product/my-chosen-product
它会显示:
http://www.mysite.com/product/my-chosen-product.htm
我对此真的很陌生。我浏览了许多其他帖子,我感到非常困惑,特别是我认为 isapi rewrite 与 mod_rewrite 的工作方式略有不同。