用于.htmlselect器的mod_rewrite

我们有一个网站,其url类似于www.example.com/about.smart.html

(如果智能手机设备是基于useragent,则应用服务器上添加了“智能”select器)

如果用户更改了URL,我们需要将页面redirect到404,如下所示:

  1. www.example.com/about.abc.xyz.smart.html
  2. www.example.com/about.smart.abc.html

我试着用下面的规则,但是这个redirect到404只有1)而不是2)

RewriteCond %{REQUEST_URI} !^(.*)(-)\.html$ RewriteRule (.*)\.(.*).smart.html$ - [R=404,L] 

任何指针在这将有很大的帮助。

尝试:

 RewriteCond %{REQUEST_URI} !^(.*)(-)\.html$ RewriteRule (.*)\.smart(\..*)?\.html$ - [R=404,L]