How would I do this?

Discussion in 'Programming' started by immortality, Mar 10, 2008.

  1. #1
    I want to make it so I can send people to a subdomain without actually creating the subdomain in my account. Would this be able to be done with custom 404 pages? Or would I need some code for this?

    What code would I use if I wanted it to use the subdomain text on the site? Saying if the user went to mysite.com/ABCD it would display on my site as "Thanks for visiting ABCD". Or if the visitor were to go to mysite.com/jasfbhiweuhr it would display "Thanks for visiting jasfbhiweuhr".

    Just wondering if this would be easy or if I will need to go get someone to code for me.
     
    immortality, Mar 10, 2008 IP
  2. Mightymousie12

    Mightymousie12 Peon

    Messages:
    62
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    simple html redirect?

    <meta http-equiv="REFRESH" content="0;url=http://www.the-domain-you-want-to-redirect-to.com"></HEAD>
     
    Mightymousie12, Mar 10, 2008 IP
  3. vpguy

    vpguy Guest

    Messages:
    275
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Those aren't subdomains, they are subdirectories or subfolders. To accomplish what you want, you need to implement URL rewriting.

    If using Apache, you would need to modify your .htaccess file. If using IIS (ASP.NET), you would need to modify your global.asax.

    Do a Google search for URL rewriting for more information.
     
    vpguy, Mar 11, 2008 IP
  4. HugePedlar

    HugePedlar Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Here's a handy guide on rewriting URLs in .htaccess - even a simpleton like me can understand it.

    corz.org/serv/tricks/htaccess2.php
     
    HugePedlar, Mar 12, 2008 IP
  5. Randombase

    Randombase Peon

    Messages:
    224
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Your host must also support URL rewriting, it must be enabled in httpd.conf. I found a lot of hosts not enabling this.
     
    Randombase, Mar 12, 2008 IP