SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    Keep Moving Forward gold trophysilver trophybronze trophy
    Shaun(OfTheDead)'s Avatar
    Join Date
    Nov 2005
    Location
    Trinidad
    Posts
    3,746
    Mentioned
    45 Post(s)
    Tagged
    0 Thread(s)

    Re-direct Entire Site... Except...

    Aloha.

    Some years ago I did a ratch job of configuring a site and it's now come back to bite me in the ass.

    See, because of a stupid mistake with my CMS I had to move all of the pages of the site down a directory... so instead of www.website.com/webpage ... I had to have www.website.com/space/webpage .

    I achieved this universal re-direct by using the following in my .htaccess file...


    Code:
    RedirectMatch permanent ^/$ http://website.co.tt/BeautySupplier/
    Now here's the problem.

    I'm trying to set up a sub-domain on the site ( http://redesign.website.co.tt/ ), but now even the sub-domain re-directs to the http://website.co.tt/BeautySupplier/ page.

    Is there a way to prevent that from happening ?




    Trying to fill the unforgiving minute
    with sixty seconds' worth of distance run.

    Update on Sitepoint's Migration to Discourse

  2. #2
    SitePoint Wizard silver trophy ldcdc's Avatar
    Join Date
    May 2004
    Location
    Ploiesti
    Posts
    4,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Perhaps putting a redirect to http://redesign.website.co.tt/ in the .htaccess file in the sub-domain's folder would work. I'm not an expert at this, and there may be more elegant/correct solutions out there.
    HostPeek.com - budget hosts, compared
    CouponsNexus.com - web hosting coupons

    Ultra Cheap Hosts | Web Hosting Reviews Forums

  3. #3
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,672
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    SOD,
    Code:
    RedirectMatch permanent ^/$ http://website.co.tt/BeautySupplier/
    That will redirect the DocumentRoot to BeautySupplier.

    IF your subdomain shares the DocumentRoot with the main domain, it will also be redirected. In other words, either POINT the subdomain to a subdirectory of the main domain (i.e., NOT a redirection) OR add an exclusion to your mod_rewrite using a RewriteCond to access and test the {HTTP_HOST} variable.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  4. #4
    Keep Moving Forward gold trophysilver trophybronze trophy
    Shaun(OfTheDead)'s Avatar
    Join Date
    Nov 2005
    Location
    Trinidad
    Posts
    3,746
    Mentioned
    45 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the advice.

    I tried what you suggested over the past few days but the global re-direct always seems to include the sub-domain, no matter where I move the docuemt root of the sub-domain to.

    When I get time I'll re-search that "RewriteCond" thing and give it another go.

    Anyways, thanks again.




    Trying to fill the unforgiving minute
    with sixty seconds' worth of distance run.

    Update on Sitepoint's Migration to Discourse

  5. #5
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,672
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    sod,

    No, it's a CPanel thing. Your control panel is not registering your subdomains correctly as you should POINT the subdomain directly to the PHYSICAL location of the subdirectory (as its DocumentRoot). Because the subdomain's DocumentRoot bypasses the main domain's DocumentRoot (and the .htaccess there), there will be no redirection.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  6. #6
    Keep Moving Forward gold trophysilver trophybronze trophy
    Shaun(OfTheDead)'s Avatar
    Join Date
    Nov 2005
    Location
    Trinidad
    Posts
    3,746
    Mentioned
    45 Post(s)
    Tagged
    0 Thread(s)
    Ore that makes sense then... Because that's what I was expecting to happen.

    I didn't even consider that it could be a control panel issue!

    How does one set up a subdomain without using a control panel ?... Would I have to actually e-mail my hosts to do it ?

    I'd prefer doing it on my own if possible.




    Trying to fill the unforgiving minute
    with sixty seconds' worth of distance run.

    Update on Sitepoint's Migration to Discourse

  7. #7
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,672
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    SOD,

    I think I would e-mail support at your host and ask about how they handle the redirects of your subdomains - they may have it setup to redirect to the main domain then to the subdirectory (why, I don't know!). TELL them what you want and they should tell you (a) they can't do it or (b) how to use your control panel to do it (note: my CPanel makes that redirection around the base domain and directly to the subdomain's directory as its DocumentRoot).

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •