We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    Quote from: sottwell at May 06, 2014, 11:55 AM
    Sounds like if furls are on, it'll redirect any non-furl URLs.

    Yes, but I think that will also happen if FURLs are off.
      Did I help you? Buy me a beer
      Get my Book: MODX:The Official Guide
      MODX info for everyone: http://bobsguides.com/modx.html
      My MODX Extras
      Bob's Guides is now hosted at A2 MODX Hosting
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Nope. Did a couple of telnet sessions.

      1. Using index.php?id=xx with FURLs on.
      HTTP/1.1 301 Moved Permanently
      Date: Tue, 06 May 2014 17:27:11 GMT
      Server: Apache/2.2.26 (Unix) mod_fastcgi/2.4.6 mod_wsgi/3.4 Python/2.7.6 PHP/5.5.10 mod_ssl/2.2.26 OpenSSL/0.9.8y DAV/2 mod_perl/2.0.8 Perl/v5.18.2
      X-Powered-By: PHP/5.5.10
      Set-Cookie: PHPSESSID=2db2aedb1fefc4ffbe0ec9c7ece12756; expires=Tue, 13-May-2014 17:27:22 GMT; Max-Age=604800; path=/revo2214/; HttpOnly
      Expires: Thu, 19 Nov 1981 08:52:00 GMT
      Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
      Pragma: no-cache
      Location: http://localhost/revo2214/list-source
      Content-Length: 0
      Content-Type: text/html
      
      Connection closed by foreign host.
      


      2. Same telnet request with FURLs turned off (HTML of page follows this):
      HTTP/1.1 200 OK
      Date: Tue, 06 May 2014 17:33:04 GMT
      Server: Apache/2.2.26 (Unix) mod_fastcgi/2.4.6 mod_wsgi/3.4 Python/2.7.6 PHP/5.5.10 mod_ssl/2.2.26 OpenSSL/0.9.8y DAV/2 mod_perl/2.0.8 Perl/v5.18.2
      X-Powered-By: PHP/5.5.10
      Set-Cookie: PHPSESSID=7245f95548d7f6a8b40a241fa78acb92; expires=Tue, 13-May-2014 17:33:10 GMT; Max-Age=604800; path=/revo2214/; HttpOnly
      Expires: Thu, 19 Nov 1981 08:52:00 GMT
      Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
      Pragma: no-cache
      Transfer-Encoding: chunked
      Content-Type: text/html; charset=UTF-8
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        And after turning on my Apache access logs, I find
        ::1 - - [06/May/2014:20:52:52 +0300] "GET /revo2214/index.php?id=3 HTTP/1.1" 301 - "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:29.0) Gecko/20100101 Firefox/29.0"
        ::1 - - [06/May/2014:20:52:52 +0300] "GET /revo2214/list-source HTTP/1.1" 200 2893 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:29.0) Gecko/20100101 Firefox/29.0"
        


        and with FURLs off
        ::1 - - [06/May/2014:20:56:00 +0300] "GET /revo2214/index.php?id=3 HTTP/1.1" 200 2901 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:29.0) Gecko/20100101 Firefox/29.0"
        
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          I suppose that it does make sense that the index.php?id=xx should be "permanently moved" to the friendly URL. Makes it hard to determine exactly what URL the visitor came in on, though.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 45892
            • 9 Posts
            Thank you for the help. Bruno17's technique of using a plugin with "onHandleRequest" worked. In my case I didn't need to "sendForward" anything.

            In conclusion:
            Friendly URLs is "on". MODX is doing the forwarding/redirecting (not .htaccess ie apache) to the friendly url. Apache sees the original request and then sees the forwarding/redirecting request (resulting in 2 Apache log entries). The $_SERVER variable values and "apache_request_headers()" values reflect the second pass through Apache.

            I needed to do work when the user arrived to the site via an index.php?id=... url. By creating a plugin that triggered on the system event "onHandleRequest", I can do the work during the initial request (and thereby use the initial request headers) before the forwarding/redirecting to the friendly URL.


              • 45892
              • 9 Posts
              This matches my testing results also.

              Quote from: sottwell at May 06, 2014, 12:56 PM
              And after turning on my Apache access logs, I find
              ::1 - - [06/May/2014:20:52:52 +0300] "GET /revo2214/index.php?id=3 HTTP/1.1" 301 - "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:29.0) Gecko/20100101 Firefox/29.0"
              ::1 - - [06/May/2014:20:52:52 +0300] "GET /revo2214/list-source HTTP/1.1" 200 2893 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:29.0) Gecko/20100101 Firefox/29.0"
              


              and with FURLs off
              ::1 - - [06/May/2014:20:56:00 +0300] "GET /revo2214/index.php?id=3 HTTP/1.1" 200 2901 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:29.0) Gecko/20100101 Firefox/29.0"