SitePoint Sponsor

User Tag List

Results 1 to 18 of 18
  1. #1
    SitePoint Member
    Join Date
    Oct 2004
    Location
    in
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    dynamic subdomain using dns+htaccess

    Dear Friends,

    i want to create a dynamic subdomain and read a file

    i have done this

    *.domainname.com 14440 in <IP>

    Options +FollowSymLinks
    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\.domains\.com$ [NC]
    RewriteCond %{HTTP_HOST} ^([a-z0-9]+)\.domain\.com$ [NC]
    RewriteRule (.*) /site.php?url=%1&path=$1 [L,QSA]

    but it's gives me a cpanel home page
    Great Success !
    Apache is working on your cPanel® and WHM™ Server

    can you help me where i am wrong.

    And - i want to run some config domains also (already created domains)

    Regards
    Webmasterhome
    Script Resource Directory
    AdvanceScripts.com

    WebMastersHome Forum
    WebMastersHome.com

  2. #2
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,692
    Mentioned
    20 Post(s)
    Tagged
    3 Thread(s)
    wmh,

    You've got it right - assuming that your cPanel will accept dynamic virtual hosting. On the other hand, if you're on Apache 1.x, add a / before the RewriteRule's regex and the leading slash in the redirection may cause problems so, if you're in DocumentRoot already, get rid of it!

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  3. #3
    SitePoint Member
    Join Date
    Oct 2004
    Location
    in
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi there,

    i have try without / but same error

    here is the apache
    Server Version: Apache/1.3.37 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.4.4 FrontPage/5.0.2.2635.SR1.2 mod_ssl/2.8.28 OpenSSL/0.9.7a
    Server Built: Mar 3 2007 15:57:03

    Please help me find the error

    regards
    webmastershome
    Script Resource Directory
    AdvanceScripts.com

    WebMastersHome Forum
    WebMastersHome.com

  4. #4
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,692
    Mentioned
    20 Post(s)
    Tagged
    3 Thread(s)
    whm,

    Did you try:
    Code:
    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\.domains\.com$ [NC]
    RewriteCond %{HTTP_HOST} ^([a-z0-9]+)\.domain\.com$ [NC]
    RewriteRule ^/(.*)$ site.php?url=%1&path=$1 [L,QSA]
    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  5. #5
    SitePoint Member
    Join Date
    Oct 2004
    Location
    in
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes..

    still i am getting the same cpanel page

    i am not able to find the error

    please help me

    url is http://any.firesafetymart.com
    Script Resource Directory
    AdvanceScripts.com

    WebMastersHome Forum
    WebMastersHome.com

  6. #6
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,692
    Mentioned
    20 Post(s)
    Tagged
    3 Thread(s)
    wmh,

    cPanel's home page should display from the home/~account/public_html/ directory. Put your files in there.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  7. #7
    SitePoint Member
    Join Date
    Oct 2004
    Location
    in
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i have already try this but same error.

    please help.

    and i have already try this home/~account/public_html/site.php

    file on root area.

    regards

    webmastershome
    Script Resource Directory
    AdvanceScripts.com

    WebMastersHome Forum
    WebMastersHome.com

  8. #8
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,692
    Mentioned
    20 Post(s)
    Tagged
    3 Thread(s)
    wmh,

    Is site.php located in your domain's DocumentRoot (i.e., located at home/~account/public_html/ so it can be accessed by http://www.example.com/site.php)?

    NOTE: If example.com is an add-on domain, site.php MUST be in the home/~account/public_html/example/ directory.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  9. #9
    SitePoint Member
    Join Date
    Oct 2004
    Location
    in
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    dear sir,

    site.php located in root directory

    home/~user/public_html/site.php

    not on addon domain

    you can access the file http://www.firesafetymart.com/site.php?url=anyurl

    regards
    webmastershome
    Script Resource Directory
    AdvanceScripts.com

    WebMastersHome Forum
    WebMastersHome.com

  10. #10
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,692
    Mentioned
    20 Post(s)
    Tagged
    3 Thread(s)
    whm,

    I tried your link and received a "page" saying Page Error. In addition, anyurl did NOT redirect. This leads me to believe that one of two things happened: 1. mod_rewrite is not enabled (use my signature's tutorial to test) or 2. .htaccess is not in that directory with site.php.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  11. #11
    SitePoint Member
    Join Date
    Oct 2004
    Location
    in
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear sir,

    url is right error if the username is not found then it give the page error

    this file is not redirect you

    you run the
    http://anyurl.firesafetymart.com
    it run the file
    http://www.firesafetymart.com/site.php?url=anyurl

    useing htaccess

    and htaccess is active because if you run the dir.firesafetymart.com it will run the and use the htaccess

    regards
    webmastershome
    Script Resource Directory
    AdvanceScripts.com

    WebMastersHome Forum
    WebMastersHome.com

  12. #12
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,692
    Mentioned
    20 Post(s)
    Tagged
    3 Thread(s)
    wmh,

    WHAT username??? Perhaps you need to show us the entire .htaccess you have in your DocumentRoot. dir "redirects" nicely but anyurl does not so there is something else going on (and it may also be in the subdomains you have setup).

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  13. #13
    SitePoint Member
    Join Date
    Oct 2004
    Location
    in
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    let me explain

    i have added the entire htaccess below

    Options +FollowSymLinks
    RewriteEngine On
    RewriteCond &#37;{HTTP_HOST} !^www\.firesafetymart\.com$ [NC]
    RewriteCond %{HTTP_HOST} ^([a-z0-9]+)\.firesafetymart\.com$ [NC]
    RewriteRule ^/(.*)$ home/user/public_html/site.php?url=%1&path=$1 [L,QSA]

    now username = url

    and i am trying to do this

    currently url below is working

    http://www.firesafetymart.com/site.p...scueResponders

    is working and i am testing on it

    now i want to do the below
    http://MegaFireRescueResponders.firesafetymart.com

    This url show the same page as above url

    and i have add a dns entry
    i have done this

    *.domainname.com 14440 in <IP>

    and try to do the same with dns+htaccess

    but getting the cpanel page

    regards
    webmastershome
    Script Resource Directory
    AdvanceScripts.com

    WebMastersHome Forum
    WebMastersHome.com

  14. #14
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,692
    Mentioned
    20 Post(s)
    Tagged
    3 Thread(s)
    wmh,

    I think you may have hit on the key: You have mass dynamic hosting setup but you do not have a VirtualHost setup for that in your httpd.conf. I believe that you merely need to duplicate your VirtualHost setup for dir and replace dir with * to allow ANY subdomain to be used. Check http://httpd.apache.org/docs/2.0/vhosts/mass.html for more details.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  15. #15
    SitePoint Member
    Join Date
    Oct 2004
    Location
    in
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi dk

    now the site is showing the home page and working on below url but not auto system

    when we use the
    http://MegaFireRescueResponders.firesafetymart.com
    it show home page

    and below url is also working
    http://MegaFireRescueResponders.fire...scueResponders

    but not showing but not showing auto

    can you help me to find the error, i am using the same htaccess

    regards
    webmastershome

    http://www.firesafetymart.com/site.p...scueResponders
    Script Resource Directory
    AdvanceScripts.com

    WebMastersHome Forum
    WebMastersHome.com

  16. #16
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,692
    Mentioned
    20 Post(s)
    Tagged
    3 Thread(s)
    wmh,

    Two things come to mind:

    1. mod_rewrite is not enabled (run the test in my tutorial Article linked in my signature).

    2. Your code requires that the uppercase characters need to be explicitly matched, i.e.,
    Code:
    RewriteEngine On
    RewriteCond &#37;{HTTP_HOST} !^www\.firesafetymart\.com$ [NC]
    RewriteCond %{HTTP_HOST} ^([a-zA-Z0-9]+)\.firesafetymart\.com$ [NC]
    RewriteCond %{REQUEST_URI} !^/?site\.php$
    RewriteRule .? site.php?url=%1&path=%{REQUEST_URI} [L,QSA]
    To prevent looping, note that I've added an exclusion for site.php AND have simplified the regex and redirection.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  17. #17
    SitePoint Member
    Join Date
    Oct 2004
    Location
    in
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi dklynn,

    Thanks for your kind help.

    now it's working..

    Regards
    Webmastershome
    Script Resource Directory
    AdvanceScripts.com

    WebMastersHome Forum
    WebMastersHome.com

  18. #18
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,692
    Mentioned
    20 Post(s)
    Tagged
    3 Thread(s)
    wmh,



    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Bookmarks

Posting Permissions

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