We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 44285
    • 13 Posts
    Can you secure modx like that ? Or is any other way to have secure login on modx ?
    I run it on a Debian VPS and mode rewrite enabled and SSL.
    When I try to use this condition, in .htaccess, it ends up in a loop, with firefox giving me this error:


    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.


    redirect loop.

    this is the .htaccess:

    # Friendly URLs Part
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} .
    # Force all pages to go to www.domain.com for SEO
    RewriteCond %{HTTP_HOST} !^www\.mydomain\.com [NC]
    RewriteRule (.*) http://www.mydomain.com/$1 [R=301,L]
    # Friendly URLs
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NC]
    # Additional Settings Follow
    ExpiresActive On
    ExpiresByType image/gif A2592000
    ExpiresByType image/jpeg A2592000
    ExpiresByType image/png A2592000
    BrowserMatch "MSIE" brokenvary=1
    BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1
    BrowserMatch "Opera" !brokenvary
    SetEnvIf brokenvary 1 force-no-vary
    AddType text/x-component .htc

    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ https://mydomain.com/manager/$1 [R=301,L]


    The address bar, turns to this:

    www.mydomain.com/manager/index.php?q=manager/manager/index.php&q=manager/manager/index.php&q=manager/manager/index.php&q=manager/manager

    I tried Apache redirect and every time ends up in a loop.
    [ed. note: modxvirtual last edited this post 13 years, 3 months ago.]
      • 44285
      • 13 Posts
      How can I fix this ?
        • 10208 ☆ A M B ☆
        • 1,780 Posts
        Quote from: modxvirtual at Jul 13, 2013, 03:28 AM


        RewriteCond %{SERVER_PORT} 80
        RewriteRule ^(.*)$ https://mydomain.com/manager/$1 [R=301,L]

        Not an .htaccess expert, but I do see that the rewrite rule
        RewriteRule ^(.*)$ https://mydomain.com/manager/$1 [R=301,L] 


        is in there twice. Maybe remove the second instance of the rule?
          Frogabog- MODX Websites in Portland Oregon
          "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
          Having server issues? These guys have MODX Hosting perfected - SkyToaster
          • 1343 ☆ A M B ☆
          • 2,213 Posts
          You new two htaccess files:

          In the webroot:

          RewriteEngine On
          RewriteBase /
          
          RewriteCond %{HTTP_HOST} .
          RewriteCond %{HTTP_HOST} !^www\.example-domain-please-change\.com [NC]
          RewriteRule (.*) http://www.example-domain-please-change.com/$1 [R=301,L]
          
          # The Friendly URLs part
          RewriteCond %{REQUEST_FILENAME} !-f
          RewriteCond %{REQUEST_FILENAME} !-d
          RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NC]
          
          #ExpiresActive On
          #ExpiresByType image/gif A2592000
          #ExpiresByType image/jpeg A2592000
          #ExpiresByType image/png A2592000
          #BrowserMatch "MSIE" brokenvary=1
          #BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1
          #BrowserMatch "Opera" !brokenvary
          #SetEnvIf brokenvary 1 force-no-vary
          


          And in the manager folder:

          RewriteEngine On
          RewriteBase /
          RewriteCond %{SERVER_PORT} 80
          RewriteRule ^(.*)$ https://yoursite.com/manager/$1
          
            Patrick | Server Wrangler
            About Me: Website | Tweets |  MODX Hosting