,等等。
我在重定向/重写方面很糟糕。 我在网站的特定子目录树中有许多 .shtml 文件,我想将其 301 .html。 所有其他 .shtml 文件都应单独保留。 使用 Apache 时,RewriteEngine 处于打开状态。
具体来说,将www.domain.com/homes/cityname/file.shtml
更改为.html对于许多城市和文件。homes
子目录是常量。
www.domain.com/status.shtml
保持原样
尝试:
RedirectMatch 301 ^/homes/(.*).shtml /homes/$1.html
如果您宁愿使用mod_rewrite而不是mod_alias:
RewriteRule ^homes/(.*).shtml /homes/$1.html [R=301]