Forum Moderators: phranque

Message Too Old, No Replies

Mod rewrite Help

         

dylan34

3:43 pm on Mar 30, 2006 (gmt 0)

10+ Year Member



i have this page:

www.mydomain.com/dylan34.html

and i wanna make it look like this

dylan34.mydomain.com

is this posibile with mod rewrite?
if not please suggest me another way.
tnx allot! dylan

jdMorgan

4:55 pm on Mar 30, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



dylan,

Welcome to WebmasterWorld!

> and i wanna make it look like this dylan34.mydomain.com

There are several steps involved in doing this:

  • Modify your DNS zone file to point the new "dylan34" subdomain to your server's IP address (or you can simply create a 'wild-card' dns record to point all subdomains to your server.)
  • Modify your server's config file (httpd.conf) to recognize requests for the subdomain and pass them into your 'account' filespace.
  • Add mod_rewrite code to recognize requests for the dylan34 subdomain and point them to the correct server file(s) and/or directories.
  • Modify the links on your pages to use the new dylan34.example.com/ URL

    Investigate the second point first before investing time in the other steps; Some hosting services will allow subdomains, and some won't.

    Jim

  • zomega42

    5:04 pm on Mar 30, 2006 (gmt 0)

    10+ Year Member



    Maybe you already know this, but normally you wouldn't need mod_rewrite for this. Just tell your host to point the subdomain to the dylan34 folder on the hard drive and it will work without any rewriting.

    dylan34

    5:22 pm on Mar 30, 2006 (gmt 0)

    10+ Year Member



    sounds preatty easy. but i dont have any one page like mydomain.com/dylan34.html i also have mydomain.com/dylan35.html
    mydomain.com/dylan36.html
    mydomain.com/brandon34.html
    mydomain.com/brandon35.html

    jdMorgan

    6:26 pm on Mar 30, 2006 (gmt 0)

    WebmasterWorld Senior Member 10+ Year Member



    As long as you have some obvious and follproof way to identify these pages, that's not a problem. (For example, all of those are five to seven lowercase letters followed by two digits.) But with mutiple 'members' you will need to define the 'wild-card' subdomain as described above. Look into the first two points in the list above and make sure your host supports this; The last two steps are (relatively) easy once those are done.

    Jim

    dylan34

    6:49 pm on Mar 30, 2006 (gmt 0)

    10+ Year Member



    tnx jim for your fast answers. but i'am getting a error when to do this:
    "Modify your server's config file (httpd.conf) to recognize requests for the subdomain and pass them into your 'account' filespace.
    "
    i'am getting this error:"Unable to change directory to /conf/: ls_dir_wrapper() failed: filemng: opendir failed: Permission denied"

    BarryStCyr

    7:12 pm on Mar 30, 2006 (gmt 0)

    10+ Year Member



    If this is a shared host you have to get your provider to do it.

    If it is your server you probably have to be signed on as root to do it.

    Barry

    dylan34

    7:41 pm on Mar 30, 2006 (gmt 0)

    10+ Year Member



    i've create a 'wild-card' dns record to point all subdomains on my server usign this steps:

    "Make sure you have a wildcard DNS entry in Domain > DNS. You can add one as followed:
    Set the "Record Type" dropdown to "A" and klick the Add button.
    In the next screen enter a * (asteriks) in the domain name field, and enter the IP address your subdomain needs to point to."

    is this the right way?

    zomega42

    7:49 pm on Mar 30, 2006 (gmt 0)

    10+ Year Member



    Yes that sounds correct. But there are two places that this needs to be set up--
    1. On your DNS server, so your visitors web browsers can find your page when they type in your domain
    2. On your host's web server, so when it receives a request for "dylan35.mydomain.com" it knows what to do with it.

    It sounds like you have step 1 under control. For step 2 you need to contact your webhost, or use their control panel to set up each subdomain so it is recognized.

    An even better solution is to host your site on a dedicated ip address. Most hosts offer this for a couple bucks per month. On a dedicated ip, all subdomains will automatically get routed to your main domain so that mod_rewrite can do its thing.

    dylan34

    7:53 pm on Mar 30, 2006 (gmt 0)

    10+ Year Member



    i have a dedicated ip adress but i cant modify server's config file (httpd.conf)

    zomega42

    11:32 pm on Mar 30, 2006 (gmt 0)

    10+ Year Member



    Hmmm.... I don't think you need to modify httpd.conf if you have a dedicated ip (although I'm not sure about this). The dns should send people to your ip, and your server should handle the request properly. If you type in whatever.yourdomain.com does your website come up? (Assuming you setup wildcard dns already)