Results 1 to 5 of 5

Thread: Can i forward users based on the domain theyve come through

  1. #1
    Squeeler Vini's Avatar
    Join Date
    Jul 2003
    Location
    Sheffield
    Posts
    1,769
    Thanks
    44
    Thanked
    8 times in 8 posts

    Can i forward users based on the domain theyve come through

    I have a few domains all on one hosting.

    Based on the domain name they type, can i forward them to root.com/domain/ via htaccess?

  2. #2
    Administrator Moby-Dick's Avatar
    Join Date
    Jul 2003
    Location
    There's no place like ::1 (IPv6 version)
    Posts
    10,665
    Thanks
    53
    Thanked
    385 times in 314 posts
    isn't that a host header thing ? ( in IIS anyways )
    I seem to remeber apache supports it to, with virtual roots ?
    my Virtualisation Blog http://jfvi.co.uk Virtualisation Podcast http://vsoup.net

  3. #3
    Squeeler Vini's Avatar
    Join Date
    Jul 2003
    Location
    Sheffield
    Posts
    1,769
    Thanks
    44
    Thanked
    8 times in 8 posts
    Quote Originally Posted by Moby-Dick
    isn't that a host header thing ? ( in IIS anyways )
    I seem to remeber apache supports it to, with virtual roots ?
    this is separate from all my other q's this is my personal webspace, with which i dont have much control, only HTaccess

  4. #4
    Ex-MSFT Paul Adams's Avatar
    Join Date
    Jul 2003
    Location
    %systemroot%
    Posts
    1,926
    Thanks
    29
    Thanked
    77 times in 59 posts
    • Paul Adams's system
      • Motherboard:
      • Asus Maximus VIII
      • CPU:
      • Intel Core i7-6700K
      • Memory:
      • 16GB
      • Storage:
      • 2x250GB SSD / 500GB SSD / 2TB HDD
      • Graphics card(s):
      • nVidia GeForce GTX1080
      • Operating System:
      • Windows 10 x64 Pro
      • Monitor(s):
      • Philips 40" 4K
      • Internet:
      • 500Mbps fiber
    You have scripting support on the host?

    In ASP you can do a server-side redirect, for example.
    ~ I have CDO. It's like OCD except the letters are in alphabetical order, as they should be. ~
    PC: Win10 x64 | Asus Maximus VIII | Core i7-6700K | 16GB DDR3 | 2x250GB SSD | 500GB SSD | 2TB SATA-300 | GeForce GTX1080
    Camera: Canon 60D | Sigma 10-20/4.0-5.6 | Canon 100/2.8 | Tamron 18-270/3.5-6.3

  5. #5
    Registered User
    Join Date
    Oct 2005
    Posts
    13
    Thanks
    0
    Thanked
    0 times in 0 posts
    If you have server rewriting rules activated on your hosting (e.g. mod-rewrite in Apache) you can do this via .htaccess.

    An example from my website for supporting multiple sub-domains:

    RewriteEngine On
    RewriteBase /

    RewriteCond %{HTTP_HOST} example.co.uk$
    RewriteCond %{REQUEST_URI} !default
    RewriteRule ^(.*)$ default/$1

    RewriteCond %{HTTP_HOST} www.example.co.uk$
    RewriteCond %{REQUEST_URI} !default
    RewriteRule ^(.*)$ default/$1

    RewriteCond %{HTTP_HOST} richard.example.co.uk$
    RewriteCond %{REQUEST_URI} !richard
    RewriteRule ^(.*)$ richard/$1

    RewriteCond %{HTTP_HOST} david.example.co.uk$
    RewriteCond %{REQUEST_URI} !david
    RewriteRule ^(.*)$ david/$1

    This directs all requests for the main website to the "default" directory, and the sub-domains "david" and "richard" to respective directories.

    The rules are applied recursively, so each of these rules is basically saying: "if the domain they've typed is richard.example.co.uk, and the filename they've asked for doesn't start with richard, then add "richard/" to the start of the filename. You need the check that you haven't already added the directory prefix, otherwise it will create an infinite loop! I found this the hard way :-)

    Do a search on google for URL rewriting via .htaccess, or give us some more detail about what exactly you want to achieve and I'll try to help :-)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 23
    Last Post: 12-09-2005, 03:27 PM
  2. Win2k domain gubbins...
    By Neo_VR in forum Software
    Replies: 2
    Last Post: 13-03-2005, 03:41 AM
  3. Are the majority of users here based in the UK?
    By Marcos in forum General Discussion
    Replies: 41
    Last Post: 20-11-2004, 12:30 AM
  4. slow domain log-on
    By oshta in forum Networking and Broadband
    Replies: 14
    Last Post: 16-10-2004, 07:47 PM
  5. Domain Controllers and Win 2k3 SBS???
    By jo8t1 in forum Help! Quick Relief From Tech Headaches
    Replies: 20
    Last Post: 16-08-2004, 11:57 AM

Posting Permissions

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