Redirect with subdomain.domain.com

Discussion in 'Apache' started by roo, Aug 15, 2006.

  1. #1
    My host recently had me change my DNS and now I'm having session problems. My website is registered as an add-on domain in Cpanel so that makes it subdomain.maindomain.com, even though it does have it's own domain. Since the DNS switch, sometimes that subdomain.domain.com format appears in the URL instead of the correct domain, and this is causing session problems. I've managed to eliminate 1 of the 2 incorrect, un-redirected URLs with this:

    RedirectMatch permanent ^/anything$ http://www.domain.com
    Code (markup):
    (The "/anything" is a CMS folder where all requests end up going anyway.) That code works in redirecting "subdomain.maindomain.com/anything", but not when that same URL has a trailing slash (subdomain.maindomain.com/anything/). So basically, I would need a code like this:

    RedirectMatch permanent ^/anything[B]/[/B]$ http://www.domain.com
    Code (markup):
    Note the trailing slash after "anything". That code doesn't work though. What can I do? I'm starting to think my host is incompetent, so if anybody could even tell me what could be done with SSH or something I would suggest that to them, because I mentioned this problem days ago and it doesn't seem like it should be that hard for a webhosting company to fix, especially since it's never happened to me before. I have a feeling it's going to be ignored anyway. Thanks very much to anybody who can help.
     
    roo, Aug 15, 2006 IP
  2. smatts9

    smatts9 Active Member

    Messages:
    1,089
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    88
    #2
    Try this may work:
    
    RedirectMatch permanent ^/anything/?$ http://www.domain.com
    
    Code (markup):
     
    smatts9, Aug 15, 2006 IP
  3. roo

    roo Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for the reply. I think that's causing an endless loop since everything on the website is in that directory. Is there any way to specify a slash?
     
    roo, Aug 15, 2006 IP
  4. Jean-Luc

    Jean-Luc Peon

    Messages:
    601
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hi,

    I understand that :
    - you own domain.com and domain2.com.
    - domain2.com points to subdomain.domain.com which you can also find under domain.com/subdomain.
    Is this correct ?

    When you type www .domain2.com in the address bar, is the content of the address bar replaced by subdomain.domain.com or by domain.com/subdomain or does it remain unchanged ?

    It is a bit complicated to analyze the problem with these domain.com and domain2.com. It would be much easier with your real URL's.

    Jean-Luc
     
    Jean-Luc, Aug 16, 2006 IP