Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

rewrite rules problem

  • 30-06-2004 03:13PM
    #1
    Subscribers Posts: 1,911 ✭✭✭


    I moved a site to a new server recently and for some reason my rewrite rules are acting slightly differently.

    On the original server, the url in the location bar and the request_uri stays the same (which I want)
    On the new server, the url changes to the url the rule redirects to.

    They're both running apache 1.3.31. I can't see any differences in their configurations. any pointers?

    rewrite rule on old server:
    RewriteRule     ^(.+)$  [url]http://defttest.eeng.may.ie/~draco/main/common/this_file.php?module_id=12[/url]
    

    rewrite rule on new server:
    RewriteRule     ^(.+)$  [url]http://wopr.eeng.may.ie/main/common/this_file.php?module_id=12[/url]
    


Comments

  • Registered Users, Registered Users 2 Posts: 9,579 ✭✭✭Webmonkey


    isn't it because the directory paths are different on the servers?


  • Banned (with Prison Access) Posts: 16,659 ✭✭✭✭dahamsta


    Draco,

    1) You don't seem to be pulling the content in parentheses into anything in the RewriteRules? There's no point in parenthesising if you're not going to backreference; it's a waste of the processor.

    2) The behaviour on server 1 is absolutely correct, mod_rewrite won't force a redirect unless you pass an [R] flag to it. With this in mind, I'm guessing it's the tilde (~) and paths causing the problem. Have a think about that and I'll come back to it tomorrow, you know, when I'm sober? :)

    adam


  • Subscribers Posts: 1,911 ✭✭✭Draco


    1) I was orginally using a backreference so that's why they're there. Gone now.

    2) My problem is with server two. It is doing the unwanted redirect. I moved stuff around on server one to get rid of the ~ and it's still working as wanted, so it's not that.


  • Banned (with Prison Access) Posts: 16,659 ✭✭✭✭dahamsta


    It's hard to tell from afar to be honest, but it's likely to be a slight difference in environment on the new server. I'd suggest setting up a RewriteLog with the RewriteLog and RewriteLogLevel directives and examining that. If you can't figure it out immediately, set the RewriteLogLevel to 9, call the URL a couple of times, and post the output here.

    adam


  • Subscribers Posts: 1,911 ✭✭✭Draco


    got it this morning. The second server thought it had to do a REDIRECT/302 as the server name was set just to wopr rather than wopr.eeng.may.ie.

    Bah. I knew it was something stupid I had missed.


  • Advertisement
  • Banned (with Prison Access) Posts: 16,659 ✭✭✭✭dahamsta


    Still unusual though, since mod_rewrite is such a low-lying module it usually takes precedence over everything else (Redirect, Alias, etc). Anyway, glad you figured it out.

    adam


Advertisement