Sergi
Sergi

Reputation: 1256

mod_rewrite for directory to another host

I need to rewrite and redirect all access to a directory to another host. I'm using Symfony2 framework and the .htaccess is in the /web directory (also the root of the virtualhost) and looks like:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]

I want all access to http://www.project1.com/foo redirected to http://www.project2.com/bar

How can I do that with htaccess?

Upvotes: 1

Views: 1531

Answers (1)

Zimbabao
Zimbabao

Reputation: 8240

Put following line in .htaccess of root

RewriteRule ^foo/(.*) http://www.project2.com/bar/$1 [QSA,L,R=302]

Upvotes: 2

Related Questions