开发者

Mod_ReWrite script from apache 1.3 doesn't work in 2.2

开发者 https://www.devze.com 2023-02-25 06:25 出处:网络
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.

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=开发者_如何学Python$3 [PT,L]


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


For Apache2.2

In your httpd.conf file you must set AllowOverride All

0

精彩评论

暂无评论...
验证码 换一张
取 消