简体   繁体   中英

.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)

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

Using .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 :

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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