We help IT Professionals succeed at work.

htaccess check domain then redirect if

movieprodw
movieprodw asked
on
676 Views
Last Modified: 2014-04-30
Hello,

I have domains

1.com
2.com
3.com
4.com
home.com

They are all running off the same web server pointed to home.com

Their domain stays 1/2/3/4

Their is a directory called /account

If #.com/account then redirect to home.com/account

If home.com/account then do nothing
Comment
Watch Question

Dan CraciunIT Consultant
CERTIFIED EXPERT

Commented:
Try this:
rewriterule ^account(.*)$ http://home.com/account$1 [r=301,nc]

Open in new window

HTH,
Dan

Author

Commented:
This is what I get:

The page isn't redirecting properly

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

    This problem can sometimes be caused by disabling or refusing to accept cookies.

Open in new window


Note: they both have the same htaccess
Dan CraciunIT Consultant
CERTIFIED EXPERT

Commented:
I think that's because I created a circular reference, so the server will keep trying to get to http://home.com/account.

Let me find out how I can prevent the server from redirecting if it's already on that page.
IT Consultant
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Perfect
Dan CraciunIT Consultant
CERTIFIED EXPERT

Commented:
Glad I could help!
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.