2013-10-12 1088 views
0

我有以下url需要重写.htaccess 例如,我要使用网站的新闻部分。.htaccess重写将不起作用或被覆盖

www.example.com/news/    -works 
www.example.com/news/latest/  -works 
www.example.com/news/1/this-is-news -does not work 

这是我当前用于“新闻”部分的.htaccess的一部分。

RewriteRule ^news/? index.php?view=news [L] 
RewriteRule ^news/([^/\.]+)/([0-9]+)/?$ index.php?view=news&task=$1&page=$2 [L] 
RewriteRule ^news/([0-9]+)/?$ index.php?view=news&id=$1 [L] 

回答

0

尝试一下本作的最后一个条目:

^news/([0-9]+)/[0-9a-z\-]*$ 

它会解决它,使任何数字,字母,在最后一个斜线破折号会被抓住,所以它会符合您的例子,至少。

+0

thx,这工作 – rokkz