简体   繁体   English

.htaccess 301重定向。 从一个域重定向到另一个域

[英].htaccess 301 redirect. Redirect from one domain to another

I want to ask, how do I redirect from this url(for example): http://firstapp.com/VD/Controller/Action (VD - is virtual directory, Action - there are many actions, so all of them should be redirected to the new url) 我想问一下,如何从该URL重定向(例如): http : //firstapp.com/VD/Controller/Action (VD-是虚拟目录,Action-有很多操作,因此应该将所有操作都重定向到新网址)

to this one: http://secondapp.com/Action ? 对此: http : //secondapp.com/Action

Using .htaccess 使用.htaccess

I try this, but it does not work 我尝试了这个,但是没有用

RewriteCond %{HTTP_HOST} ^(.*)$ [NC]
RewriteRule ^/VD/Controller/(.*)$ http://secondapp.com/$1 [L,R=301,NC]

Place this rule in root .htaccess of firstapp.com : 将此规则放在firstapp.com根.htaccess中:

RewriteEngine On
RewriteCond %{HTTP_HOST} firstapp\.com$ [NC]
RewriteRule ^VD/Controller/(.*)$ http://secondapp.com/$1 [L,R=301,NC]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM