LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   How to redirect to three different domains with .htaccess? (https://www.linuxquestions.org/questions/linux-server-73/how-to-redirect-to-three-different-domains-with-htaccess-915190/)

plotinus 11-23-2011 04:17 PM

How to redirect to three different domains with .htaccess?
 
Hi all,
I don't know how to do the following redirects:
Code:

my-domain.com -> other-domain.com
my-domain.com/folder-A -> my-domain.com/folder-A
my-domain.com/folder-B -> other-domain.com/folderX/folderY/file.html

I'm using redirect, rewritecond + rewriterule, but I only can get errors. The more articles I read, the worst my .htacces works.
Can anybody help me?
Thanks!
P

rhbegin 11-23-2011 04:53 PM

Be sure to make a copy of the working config, I have configured .htaccess with 1 domain.

I will do some research, I may have a friend that has done this before.

bathory 11-24-2011 12:38 AM

Hi,

You don't say what happens to any other any URL in my-domain.com? If you don't want them rewritten, you can use the following in a .htaccess in my-domain.com docroot:
Code:

RewriteEngine on

RewriteCond  %{REQUEST_URI} !^/folder-A
RewriteCond  %{REQUEST_URI} ^/$
RewriteRule (.*) http://other-domain.com

RewriteCond  %{REQUEST_URI} !^/folder-A
RewriteCond  %{REQUEST_URI} ^/folder-B
RewriteRule ^folder-B http://other-domain.com/folderX/folderY/file.html?

Regards


All times are GMT -5. The time now is 12:32 PM.