k0lpak
k0lpak

Reputation: 553

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

Upvotes: 0

Views: 73

Answers (1)

anubhava
anubhava

Reputation: 785146

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]

Upvotes: 1

Related Questions