0

例如,我有以下页面给出 404 错误

http://www.example.com/requirements/about-tn/about-us.html

只有当上面的页面返回 404 错误时,我才希望上面的页面到下面的 url

http://rd.example.com/requirements/about-tn/about-us.html

我怎样才能在.htaccess 中做到这一点?

赞赏

问候, 拉贾

4

1 回答 1

1

www.example.com的文档根目录下的 htaccess 文件中,添加:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?example.com$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?requirements/about-tn/about-us.html http://rd.example.com/requirements/about-tn/about-us.html [L,R]
于 2012-10-10T16:09:50.463 回答