0

我目前有很多这样的 URL:

http://www.domain.com/classes-dallas-tx.html

我需要将所有 URL 更改为以下内容:

http://www.domain.com/classes-in-dallas-tx.html

我只需要将“in”添加到现在没有它的每个 URL 中。

是否有一个查询可以用于 .htaccess 文件来为我处理所有 URL?我打算使用 301 重定向。

谢谢!

4

1 回答 1

0

尝试:

RedirectMatch 301 ^/([^-]+)-([^-]+)-([^-]{2})\.html$ /$1-in-$2-$3.html

或者

RewriteEngine On
RewriteRule ^/?([^-]+)-([^-]+)-([^-]{2})\.html$ /$1-in-$2-$3.html [L,R=301]

在文档根目录的 htaccess 文件中。

于 2012-11-28T06:41:22.177 回答