views:

13

answers:

2

I'd like to redirect a website from http:// domain.com & http:// www.domain.com to http://v2.domain.com, while maintaining access to http:// (www.)domain.com/images/*

I've tried several methods but somehow I can no longer access the /images folder anymore.

P.S: both subdomain & root has different content/CMS. Any ideas as to how to implement this?

Thanks

A: 

You haven't explained exactly how these are configured. I'm going to assume that www.domain.com and v2.domain.com are different virtual hosts:

You should be able to do this in your .htaccess file or apache configuration for www.domain.com:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !images/
RewriteRule ^/(.*)                      http://v2.domain.com/$1 [L,R]
Paul Schreiber
Nope, they are in the same virtual host. I tried something like this:<code> Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} !^/images/ RewriteCond %{HTTP_HOST} !v2\.domain\.com$ [NC] RewriteRule ^(.*)$ http://v2.domain.com/ [R=302,L]</code>
CincauHangus
A: 

I realised something like this could work as well. Probably need some testing, but if this is wrong do comment.

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/images/
RewriteCond %{HTTP_HOST} !v2\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://v2.domain.com/ [R=302,L]
CincauHangus