SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Apr 2005
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    excuse me, more again in mod_rewirteCon,etc

    Dear gentlemen,

    I still got mess as the simplest codes below even can not pass:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^a\.java\.net\.nl$ [NC]
    RewriteRule ^$ /products/aindex.jsp [L]

    RewriteCond %{HTTP_HOST} ^b\.java\.net\.nl$ [NC]
    RewriteRule ^$ /products/bindex.jsp [L]

    notes:
    I want to build up several simplest secondary subdomain name for the current several web-module entry. Above, as I metioned hours before, I thought it means:

    if(httphost=="a.java.net.nl") then url=/products/aindex.jsp
    if(httphost=="b.java.net.nl") then url=/products/bindex.jsp

    not any interpretations else,right?

    but in runtime, the first one interpret ok, but the next one just disappear, it went to the firt Virutalhost set in the httpd.conf, and response another absolute wrong page for me.

    where I unerstood wrong for the RewriteCond as well as RewriteRule?

    frederick
    Last edited by ZCoral; Apr 7, 2005 at 06:03.

  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)
    Z,

    Quote Originally Posted by ZCoral
    I still got mess as the simplest codes below even can not pass:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^a\.java\.net\.nl$ [NC]
    RewriteRule ^$ /products/aindex.jsp [L]

    RewriteCond %{HTTP_HOST} ^b\.java\.net\.nl$ [NC]
    RewriteRule ^$ /products/bindex.jsp [L]

    notes:
    I want to build up several simplest secondary subdomain name for the current several web-module entry. Above, as I metioned hours before, I thought it means:

    if(httphost=="a.java.net.nl") then url=/products/aindex.jsp
    if(httphost=="b.java.net.nl") then url=/products/bindex.jsp

    not any interpretations else,right?

    but in runtime, the first one interpret ok, but the next one just disappear, it went to the firt Virutalhost set in the httpd.conf, and response another absolute wrong page for me.

    where I unerstood wrong for the RewriteCond as well as RewriteRule?

    frederick
    Hmmm, now the light is beginning to come on! If you're making all these regex redirects based on virtual hosts, that virtual host has to be defined in your httpd.conf (and hosts) file in order to be directed to the directory where you have your .htaccess (for the redirect). Apparently, your a server is correctly setup but the b server is not.

    Please have a look at your Virtual Host setup as that's likely where the problem lies.

    Oh, yeah, that said, the only thing that I'd comment on with your redirects is that WinDoze (which I use) and Linux seem to treat the leading slash in the redirect differently - so I avoid that like the plague ( I hide from that problem rather than figuring it out ). Assuming that you're already in the virtual host's root directory, that slash isn't necessary - if not, I hide behind an absolute URL in the redirect.

    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
    Apr 2005
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks DK, may be I just did make it very clearly. my previous setting was irrelevant for current virtualhost setting, neither a nor b virtualhost is not existed, I just want to map the http://a.java.net.nl to aindex.jsp AND http://b.java.net.nl to bindex.jsp, whose I have to locate by http://www.java.net.nl/pindex.jsp, and so on.

    these setting I have tested for manytimes but just puzzled what the second rewritecond do not work even in the same format. however, however, however, as long as I restart it again on afternoon, for the god sake, dont ask me why, it work ok ??!!

    I do not know whether it is some cache in apache did it , I realy do not know.

    anyway I thank for your enthusiastic help, you guide me inside. thank you
    frederick Z Coral

  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)
    Z,

    No worries, mate! Just remember that subdomains are treated as separate domains and must be registered with httpd.conf and the hosts file that's being used.

    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
  •