RewriteRule works on Apache 1.3, but not 2.2

Discussion in 'Apache' started by mika, Oct 1, 2006.

  1. #1
    So I have the following rule:

    RewriteRule ^abc/$ ../domain.com/abc/def/?hl=de [L,QSA]
    Code (markup):
    It works on my local Apache 1.3, but doesn't work on my dedicated Apache 2.2.2. It's giving me the following error message:

    Does anybody know why?

    The paths are exactly the same on the both servers.
     
    mika, Oct 1, 2006 IP
  2. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #2
    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^abc/$ abc/def/?hl=de [L,QSA]
     
    Nintendo, Oct 2, 2006 IP
  3. mika

    mika Active Member

    Messages:
    136
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #3
    Hi Nintendo,

    thanks for you help. I already have the Options you mentioned in my httpd.conf.

    The problem is that I don't want to use abc/def/?hl=de, but I want to get out of the document root and then get into another folder: ../domain.com/abc/def/?hl=de

    Is this not allowed in Apache 2 anymore or is it a configuration issue, like an option in httpd.conf (I went through it yesterday but couldn't find anything)?

    I even tried to do the following:

    RewriteRule ^abc/$ http://www.domain.com/abc/def/?hl=de [L,QSA]

    But it keeps redirecting http://sub.domain.com/abc/ to http://www.domain.com/abc/def/?hl=de.
     
    mika, Oct 2, 2006 IP
  4. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #4
    Only time the domain.com part would need to be there is when doing a redirect.
     
    Nintendo, Oct 2, 2006 IP
  5. mika

    mika Active Member

    Messages:
    136
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #5
    OK, but I don't want to have a redirect.

    Look:

    I have some files in
    /home/www/domain.com/abc/def/
    that I want to use in the RewriteRules of the .htaccess in
    /home/www/sub.domain.com/

    Is this possible?
     
    mika, Oct 2, 2006 IP
  6. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #6
    /home/www/domain.com/ isn't even supposed to be in .htaccess.

    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^abc/$ abc/def/ [L]

    makes domain.com/abc/ show the same thing as domain.com/abc/def/

    Is this for just one URL? ([^.]+) and $1 is there's more than one directory.
     
    Nintendo, Oct 3, 2006 IP
  7. mika

    mika Active Member

    Messages:
    136
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #7
    But I need sub.domain.com to show domain.com/abc/def/?hl=de.

    I want to make several subdomains, like sub2.domain.com, sub3.domain.com etc. to show domain.com/abc/def/?hl=en, domain.com/abc/def/?hl=pl etc.
     
    mika, Oct 3, 2006 IP
  8. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #8
    Sorry, you're toast there. You would have to edit the apache file for that.
     
    Nintendo, Oct 4, 2006 IP
  9. mika

    mika Active Member

    Messages:
    136
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #9
    Do you mean the httpd.conf? I can do that -- please just tell me what I'd have to edit :D
     
    mika, Oct 4, 2006 IP
  10. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #10
    I'm not sure what you have to change in that file to do it.
     
    Nintendo, Oct 4, 2006 IP
  11. mika

    mika Active Member

    Messages:
    136
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #11
    OK, I guess I'll have to do it the same way Menalto Gallery does it. Thanks anyway :)
     
    mika, Oct 5, 2006 IP