Find the answer to your Linux question:
Results 1 to 6 of 6
I want to make subdomains that point to subdirectories. I've got the code to do this in the httpd.conf file. However on my new host, I don't have access to ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2004
    Posts
    2

    Apache rewrite directives in .htaccess? subdomains?


    I want to make subdomains that point to subdirectories.

    I've got the code to do this in the httpd.conf file. However on my new host, I don't have access to the httpd.conf file, nor 'official' support for subdomains.

    Is it possible to put rewrite directives in the .htaccess file?
    I tried and it didn't seem to work properly - is there something special I need to do?

    Thanks

  2. #2
    Linux User
    Join Date
    Jan 2003
    Location
    Cardiff, Wales
    Posts
    478

    yes

    yes it is possible.

    check this out
    http://httpd.apache.org/docs/misc/rewriteguide.html

    but. Doesn't aren't domain names governed more by dns that by apache.
    e.g. www.hello.com is a computer called www in the hello.com domain. if you want to have www.goodbye.hello.com then thats a separate dns entry for a computer called www in the goodbye.hello.com domain which is a subdomain of the hello.com domain.

    so you will need to be sure that everything .hello.com goes to your server - then url rewriting will work.

    Can anyone else confirm this?
    No trees were harmed during the creation of this message. Its made from a blend of elephant tusk and dolphin meat.

  3. #3
    Just Joined!
    Join Date
    Mar 2004
    Posts
    2
    OK so I have to:

    1. make sure that the DNS servers send *.hello.com to the right IP.
    2. set up the rewrite directives.

    However, does it matter that I put the directives into .htaccess? as opposed to httpd.conf?

  4. #4
    Linux User
    Join Date
    Jan 2003
    Location
    Cardiff, Wales
    Posts
    478

    rewites

    You can put rewrite directives in the .htaccess files. the link to the apache reference states that
    ATTENTION: Depending on your server-configuration it can be necessary to slightly change the examples for your situation, e.g. adding the [PT] flag when additionally using mod_alias and mod_userdir, etc. Or rewriting a ruleset to fit in .htaccess context instead of per-server context. Always try to understand what a particular ruleset really does before you use it. It avoid problems.
    But it gives no further explanantion. So I assume that all will work in excatly the same way. Get the rest working and then if you have problems with the rewrite rules post them here and we'll have a look.
    No trees were harmed during the creation of this message. Its made from a blend of elephant tusk and dolphin meat.

  5. #5
    Linux Engineer Giro's Avatar
    Join Date
    Jul 2003
    Location
    England
    Posts
    1,219
    If you put them in a .htaccess you need to have AllowOverrides All the problem is that all the rules are parsed each time a page is visited if you have alot eg. rewrite ugly query strings to static pages this can be slow but if they are in the httpd.conf they are parsed once when apache starts. HTH

  6. #6
    Just Joined!
    Join Date
    Nov 2006
    Posts
    1

    Smile possible

    you have to make sure that you have wildcard DNS

    then and then you can make subdir act like subdomain

    -ENIL
    http://www.design-web-site.net/

Posting Permissions

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