LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 11-23-2011, 04:17 PM   #1
plotinus
LQ Newbie
 
Registered: Nov 2011
Distribution: centOS 5.7, fedora 15,ubuntu 11.04
Posts: 20

Rep: Reputation: Disabled
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
 
Old 11-23-2011, 04:53 PM   #2
rhbegin
Member
 
Registered: Oct 2003
Location: Arkansas, NWA
Distribution: Fedora/CentOS/SL6
Posts: 381

Rep: Reputation: 23
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.
 
Old 11-24-2011, 12:38 AM   #3
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,937

Rep: Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330
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
 
  


Reply

Tags
domain, htaccess, redirect


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Redirect with htaccess chandranjoy Linux - Server 1 02-16-2011 07:40 AM
Apache htaccess redirect Jorkim Kustafin Linux - Server 2 07-23-2009 12:32 PM
Addon Domains dont load with .htaccess Html33 Linux - Server 1 07-21-2008 11:05 AM
htaccess 'redirect permanent' failing mikeindo Linux - Networking 0 07-07-2005 01:05 AM
Htaccess with a redirect Diode Linux - Networking 0 10-28-2003 06:23 PM


All times are GMT -5. The time now is 01:02 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration