We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40118
    • 10 Posts
    I refer to the article at:

    http://akparawa.net/modx-revolution-development-with-wampserver-part-10-contexts.html

    I followed the instructions but when i tried to go to a subfolder location like:

    http://localhost/myrevo/anotherrevo/test2.html , i get a page on Firefox (and other browsers) that says something along the lines of: "
    The page isn't redirecting properly

    Firefox has detected that the server is redirecting the request for this address in a way that will never complete. "

    I'm usign the latest Modx revolution version 2.2.2. Fyi, I'm a first-time ModX user, so I'm unsure exactly which earlier versions did work and perhaps the new version(s) had some auto-redirection scheme (from what I see, ModX would automatically 301 redirect any index.php?q=test.html calls over to /test.html, if SEO friendly URLs are turned on, which might be causing infinite loops if I might go from test.html to index.php?q=test.html, and back again. The strange thing is, it works OK on the root folder location, only the subdomain folder has problems.

    --------

    Ok, I tested on 2 earlier versions. Here are my results:

    VERSION RESULTS:
    ------------------------

    Tried with Version 2.1.3 (the version for the tutorial)

    http://localhost/modx213/subdomain/?q=test.html (address bar URL remains, no 301 redirect change except for start_page cases)
    or
    http://localhost/modx213/subdomain/test.html

    content shows up fine.


    __________

    But On version 2.2.1 or higher. (Haven’t tried lower versions yet)

    http://localhost/modx213/subdomain/?q=test.html (url on address bar shows latter link below..possibly a 301 redirect) to....

    … http://localhost/modx213/subdomain/test.html

    Mod redirect occurs on subdomain folder at test.html (due to htaccess there), will always redirect it back to index.php?q=$1, thus, resulting in an infinite loop (circle dependency back and forth..).

    On root location, no issue with infinite loops.

    On start_page cases within root and subdomain, no issue with infinite loops.

    _____________

    Question is: From which version was this friendly url redirect-back change made, and any ways of solving this problem with the current version? Why is it when accessing a non-starting page on a subdomain from the subfolder folder directly, would there be a redirection loop occuring, but not for start pages and pages on the root location? Is there anyway to look for a GET flag to at least absolutely avoid the friendly url redirect header,?
      • 40118
      • 10 Posts
      Ok, after a bit of trial and error, I found a working combination for v2.2.2 to prevent infinite redirect-backs from within the subdomain folder.

      Subdomain .htaccess:

      RewriteBase /domain/subdomain
      _____________

      Subdomain context settings:

      base_url: /domain/subdomain/ <- remember to include leading slash
      http_host: localhost
      site_url: http://localhost/domain/subdomain

      _______

      Anyway, I'm not too sure if this is the "right" solution. This solution would only work for pure sub-folder access only (ie. absolutely no use of virtual hosts).

      If virtual hosts are used like in http://rtfm.modx.com/display/revolution20/Creating+a+Subdomain+from+a+Folder+using+Virtual+Hosts

      then I'd like to add that using the following line of rewrite code will redirect any /subdomain/ folder access to the virtual host.

      #RewriteCond %{HTTP_HOST} localhost [NC]
      #RewriteCond %{REQUEST_URI} ^/domain/subdomain/(.*)$
      #RewriteRule .* http://subdomain/%1 [QSA,L] [ed. note: glidiasrage last edited this post 14 years, 4 months ago.]
        • 45644
        • 2 Posts
        Quote from: glidiasrage at Jun 13, 2012, 12:34 AM
        Ok, after a bit of trial and error, I found a working combination for v2.2.2 to prevent infinite redirect-backs from within the subdomain folder.

        Subdomain .htaccess:

        RewriteBase /domain/subdomain
        _____________

        Subdomain context settings:

        base_url: /domain/subdomain/ <- remember to include leading slash
        http_host: localhost
        site_url: http://localhost/domain/subdomain

        _______

        Anyway, I'm not too sure if this is the "right" solution. This solution would only work for pure sub-folder access only (ie. absolutely no use of virtual hosts).

        If virtual hosts are used like in http://rtfm.modx.com/display/revolution20/Creating+a+Subdomain+from+a+Folder+using+Virtual+Hosts

        then I'd like to add that using the following line of rewrite code will redirect any /subdomain/ folder access to the virtual host.

        #RewriteCond %{HTTP_HOST} localhost [NC]
        #RewriteCond %{REQUEST_URI} ^/domain/subdomain/(.*)$
        #RewriteRule .* http://subdomain/%1 [QSA,L]


        Thanks glidiasrage for this
        base_url: /domain/subdomain/ <- remember to include leading slash

        I really forgot that on the local you need to put also the domain on base url and i've lost 2 hours until I found your post, Thanks!