我可以使用 .htaccess 规则对站点使用通配符,然后对特定页面进行重写吗?

Can I use .htaccess rules using wildcard for site, followed by rewrites for specific pages?

我正在尝试永久重定向整个网站,其中大约有除了新域外,130 个链接保持不变,然后大约。必须按文件名重定向 20 个链接。我无法获得执行这两项操作的代码。

我的 htaccess 页面的第一行开头是这样的:

RewriteEngine on
RewriteRule ^resources$ http://www.thelastdancer.com/blog? [R=301,L]
RewriteRule ^(.*)$ https://thelastdancer.com/ [R=301,L]

我可以让第二条规则起作用 - 当 /pagetitle 匹配时,我的所有文章都可以完美重定向。 我无法让单个页面重定向: https://balletforadults.com/resources SHOULD OPEN TO https://thelastdancer.com/blog 我也试过把第一条规则放在第二个位置,没有运气。

感谢您的任何指导 - 我一直在搜索堆积如山的重定向代码,但没有任何效果。

能否请您尝试遵循根据您显示的示例编写的规则。我们需要在这里使用 RewriteCond 来检查来自哪个域名(主机)名称请求,然后相应地将请求从 bal.... 重定向到 thelasdancer 域。

RewriteEngine ON
RewriteCond  %{HTTP_HOST} balletforadults\.com [NC]
RewriteRule ^resources/?$ http://thelastdancer.com/blog [R=301,L]