apache 1.3 中的 Mod_ReWrite 脚本在 2.2 中不起作用

发布于 2024-11-02 02:34:46 字数 809 浏览 0 评论 0原文

我一直在使用以下脚本来获取友好的 url,它在 apache 1.3 中工作正常。我们刚刚升级到 apache 2.2.17,它似乎不再工作了。

有什么需要调整才能在 2.2 中工作吗?

 mysite.com/products?BRAND=ADIDAS&VENDORCODE=581 (ORIGINAL URL)
 mysite.com/products/ADIDAS/581 (FRIENDLY URL)



Options +FollowSymLinks 
RewriteEngine On 

RewriteRule ^(.*/)?products/([^/]+)/([0-9]+)/?$ $1/products?BRAND=$2&VENDORCODE=$3 [PT,L] 
RewriteRule ^(.*/)?products/([^/]+)/([^/]+)/([0-9]+)/?$ $1/products?BRAND=$2&VENDORCODE=$3&offset=$4 [PT,L]

RewriteRule ^(.*/)?DeptItems/([^/]+)/([0-9]+)/?$ $1/DeptItems?BRAND=$2&catCode=$3 [PT,L]
RewriteRule ^(.*/)?DeptItems/([^/]+)/([^/]+)/([0-9]+)/?$ $1/DeptItems?BRAND=$2&catCode=$3&offset=$4 [PT,L]

RewriteRule ^(.*/)?itemdetail/([^/]+)/([^/]+)/?$ $1/itemdetail?BRAND=$2&desc1=$3 [PT,L]

I had been using the following script for friendly urls and it is working fin in apache 1.3. We just upgraded to apache 2.2.17 and it doesnt seem to be working anymore.

Is there something that needs to be tweaked to work in 2.2?

 mysite.com/products?BRAND=ADIDAS&VENDORCODE=581 (ORIGINAL URL)
 mysite.com/products/ADIDAS/581 (FRIENDLY URL)



Options +FollowSymLinks 
RewriteEngine On 

RewriteRule ^(.*/)?products/([^/]+)/([0-9]+)/?$ $1/products?BRAND=$2&VENDORCODE=$3 [PT,L] 
RewriteRule ^(.*/)?products/([^/]+)/([^/]+)/([0-9]+)/?$ $1/products?BRAND=$2&VENDORCODE=$3&offset=$4 [PT,L]

RewriteRule ^(.*/)?DeptItems/([^/]+)/([0-9]+)/?$ $1/DeptItems?BRAND=$2&catCode=$3 [PT,L]
RewriteRule ^(.*/)?DeptItems/([^/]+)/([^/]+)/([0-9]+)/?$ $1/DeptItems?BRAND=$2&catCode=$3&offset=$4 [PT,L]

RewriteRule ^(.*/)?itemdetail/([^/]+)/([^/]+)/?$ $1/itemdetail?BRAND=$2&desc1=$3 [PT,L]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

灯下孤影 2024-11-09 02:34:46

RewriteEngine On 需要独占一行。它不是 Options 的参数。

RewriteEngine On needs to be on its own line. Its not an argument to Options.

逐鹿 2024-11-09 02:34:46

对于 Apache2.2

在您的 httpd.conf 文件中,您必须设置 AllowOverride All

For Apache2.2

In your httpd.conf file you must set AllowOverride All

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文