.htaccess和RewriteRule表达式

时间:2011-09-19 09:54:42

标签: html apache .htaccess

我有以下urls domain / jcb-wine {number} .html,我需要像domain / wines / {number}一样重写它们 我做这样的事情

RewriteRule ^jcb-wine([0-9][0-9])$ /wines/$

但这没有效果:(

我的.htaccess

ErrorDocument 404 /404.shtml
Options +FollowSymLinks

RewriteEngine On
RewriteBase /
RewriteRule ^wine/([0-9]{2}) /jcb-wine$1.html

怎么做?

2 个答案:

答案 0 :(得分:3)

不应该反过来吗?

RewriteRule ^wine/([0-9]+) /jcb-wine$1.html

答案 1 :(得分:0)

删除^或写完全uri像

RewriteRule ^/jcb-wine([0-9]+)/?$ /wines/$1