Apache rewrite shenanigans

  • Page

    of 1

    Previous Next
  • Quint2020 8 Dec 2009 10:26:34 3,484 posts
    Seen 8 months ago
    Registered 7 years ago
    I'm wondering if any of you can help with a little apache headache I'm having at the moment?

    I want to take a url like the following: www.domain.com/customername/appname and turn it in to the following: customername.domain.com/appname but for the life of me I can't seem to get it to work, any ideas?
  • corimi 8 Dec 2009 11:18:52 1,311 posts
    Seen 3 years ago
    Registered 8 years ago
    Heh, I was attempting a similar thing last night, though I was just trying to remove a directory name from the URI. Didn't manage it though but it wasn't critical.

    In your case, would something like this work?
    RewriteCond %{HTTP_HOST} ^domain\.com/(*.)/appname
    RewriteRule ^/(.*)$/appname http://$1.domain.com/appname [L]

    Note: I am abysmal at regular expressions (and apache stuff in general), so that's likely to fail as well.

    This page seemed pretty good though if you haven't come across it:
    http://corz.org/serv/tricks/htaccess2.php
  • Quint2020 8 Dec 2009 12:49:18 3,484 posts
    Seen 8 months ago
    Registered 7 years ago
    Cheers for the reply mate. Even if it doesn't work completely as it should it's at least put me in the right the direction!
  • Page

    of 1

    Previous Next
Log in or register to reply