mod_rewrite
Results 1 to 7 of 7

Thread: mod_rewrite

  1. #1
    Senior Member
    Join Date
    Jan 2002
    Posts
    227

    Question mod_rewrite

    Hi all!

    I've played with mod_rewrite and I have question: I have this syntax in .htaccess
    Code:
    RewriteEngine On  
    RewriteRule ^skeleti/lidi/(.*)\.htm$ http://mama.ath.cx/skeleti/lidi.php?kdo=$1 [L]
    It works fine, it loads the correct page - for example for skeleti/lidi/sun.htm it loads skeleti/lidi.php?kdo=sun BUT it also changes the browsers location field - and that's what I don't want to. So is there any way, to have the right site loaded, but the browsers location field remain unchanged?

    Btw it apache 1.3.. Thanx for your answers!
    http://promote.opera.com/small/opera94x15.gif

    [gloworange]Sun7dots[/gloworange]

  2. #2
    Banned
    Join Date
    Jul 2001
    Posts
    1,100
    Greetings:

    mod_rewrite can get pretty hairy sometimes. Off the top of my head, the easiest way I can think of to do it would be to enable mod_proxy and use the P flag in your rewrite ruleset. This would take care of what you mentioned above, and FYI also allow you to bring outside servers into the local name space too (I use to do this when I ran AO off of multiple webservers, to bring them all in under the primary www.AntiOnline.com domain).

    There may be other ways to accomplish this as well, if you dig into the rewrite docs.

  3. #3
    Senior Member
    Join Date
    Jan 2002
    Posts
    227
    Great it works! Thank you very much. But one question: Is it safe, to have this mod_proxy enabled?
    http://promote.opera.com/small/opera94x15.gif

    [gloworange]Sun7dots[/gloworange]

  4. #4
    Banned
    Join Date
    Jul 2001
    Posts
    1,100
    Greetings:

    Again, I'm just going off of memory, so you might want to double check me on this:

    I BELIEVE that the "ProxyRequests Off" directive will prevent Apache from being used as an open proxy (ie not allow remote users to make proxy requests through it), but will still allow proxy requests to be made internally (ie via mod_rewrite statements).

    Other than unknowingly hosting an open proxy, I can't really think of any other things you need to worry about. Make sure you're using the latest version of Apache though, as I believe there was an exploit out with older versions of mod_proxy some time back.

  5. #5
    Senior Member
    Join Date
    Jan 2002
    Posts
    227
    Thank you very much. Great info
    http://promote.opera.com/small/opera94x15.gif

    [gloworange]Sun7dots[/gloworange]

  6. #6
    Senior Member
    Join Date
    Jan 2002
    Posts
    1,207
    I believe mod_proxy is only for *forward* proxying, i.e. proxing for clients.

    Server proxying (proxying for servers) is part of mod_rewrite so not affected by the classic proxy settings.

    But I could be wrong.

    Slarty

  7. #7
    Banned
    Join Date
    Jul 2001
    Posts
    1,100
    Greetings All:

    Originally posted here by slarty
    I believe mod_proxy is only for *forward* proxying, i.e. proxing for clients.

    Server proxying (proxying for servers) is part of mod_rewrite so not affected by the classic proxy settings.

    But I could be wrong.

    Slarty
    Oooook. You got me doubting myself, so I took the time to go through the Apache docs.

    http://httpd.apache.org/docs/mod/mod_rewrite.html

    'proxy|P' (force proxy)
    This flag forces the substitution part to be internally forced as a proxy request and immediately (i.e., rewriting rule processing stops here) put through the proxy module.
    ....
    Notice: To use this functionality make sure you have the proxy module compiled into your Apache server program. If you don't know please check whether mod_proxy.c is part of the ``httpd -l'' output. If yes, this functionality is available to mod_rewrite. If not, then you first have to rebuild the ``httpd'' program with mod_proxy enabled.
    So believe my initial comments above are correct.

Posting Permissions

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