我正在合并两个独立的网站,因为其中一个网站将很快关闭。
现在,domainA.es和domainB.es指向相同的服务器,内容和htaccess。 我想将旧网址模拟为新网址,例如:
< ---另一个复杂问题(至少对我来说)是域A,使用永久链接,这是文件。
换句话说,我需要将旧网址映射到新网址。
domainB.es/foo.asp --> domainA.es/bar/
domainB.es/something.php--> domainA.es/otherThing/
我尝试使用
Redirect 301 /foo.asp domainA.es/bar
但是我无法完全控制原始URL(例如http或https),并且最终URL被破坏,因为文件名包含在重定向的末尾:
domainA.es/bar/foo.asp
顺便说一句,解决方案是使用RewriteCond和RewriteRule,但我不知道如何。
答案 0 :(得分:1)
试试这个
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?domainB\.es$
RewriteRule ^foo$ http://domainA.es/bar [L,R,NC]
这会将https://azure.microsoft.com/en-us/documentation/articles/storage-import-export-service/重定向到http://domainB.es/foo