.htaccess 将seo友好URL重定向到映射到domain.com的子域

.htaccess 将seo友好URL重定向到映射到domain.com的子域,.htaccess,.htaccess,我正在尝试将seo友好的URL重定向到映射到我的主域的子域,这样子域就不会真正包含任何内容。这只是化妆而已 RewriteEngine on RewriteBase / ErrorDocument 404 /notfound.php RewriteRule ^$ index.php [L] RewriteRule ^videos/(.*)-([0-9]+).html /videos/r/$1/ [R=301,L] RewriteRule ^watch/([^/\.]+)/([^/\.]+).

我正在尝试将seo友好的URL重定向到映射到我的主域的子域,这样子域就不会真正包含任何内容。这只是化妆而已

RewriteEngine on
RewriteBase /

ErrorDocument 404 /notfound.php

RewriteRule ^$ index.php [L]
RewriteRule ^videos/(.*)-([0-9]+).html /videos/r/$1/ [R=301,L]
RewriteRule ^watch/([^/\.]+)/([^/\.]+).html$ /videos/$2-$1.html [R=301,L]
RewriteRule ^video/([^/\.]+)-([0-9]+).html$ watch.php?id=$2 [L]
RewriteRule ^video/(.*)/([^/\.]+)-([0-9]+).html$ watch.php?id=$3 [L]

这将生成domain.com/video/seofriendyurl.html,我希望它重定向到subdomain.domain.com/video/seofriendlyurl.html。这只是化妆而已。因此,如果我转到domain.com/video/seofriendyurl.html,我希望被重定向到subdomain.domain.com/video/seofriendlyurl.html。

当使用
[R=301]
时,建议使用FQDN。
从:

前缀替换为http://thishost[:thisport]/(使新URL成为URI)以强制外部重定向

所以你的规则是

RewriteRule ^$ index.php [L]
RewriteRule ^videos/(.*)-([0-9]+).html http://subdomain.domain.com/videos/r/$1/ [R=301,L]
RewriteRule ^watch/([^/\.]+)/([^/\.]+).html$ http://subdomain.domain.com/videos/$2-$1.html [R=301,L]
RewriteRule ^video/([^/\.]+)-([0-9]+).html$ watch.php?id=$2 [L]
RewriteRule ^video/(.*)/([^/\.]+)-([0-9]+).html$ watch.php?id=$3 [L]

没有任何更改,或者没有显示任何页面?在这种情况下,
重写规则
无法捕获您输入的URL。如果没有更清晰的测试用例,比如实际的URL,它应该与您拥有的规则相匹配,我们就不可能提供帮助。我还建议您在中测试
重写规则。