We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36225
    • 20 Posts
    Hi all,

    I have a modx site http://mysite.com (without www) protected with htaccess and with friendly URLs.
    I have to htaccess-log in twice in order to get into the manager because of a intermediate redirection to http://www.mysite.com/manager (with www).

    So the steps are :
    1. Go to http://mysite.com/manager => first htaccess-log in just to see the manager login form
    2. Enter the modx login and password for an editor => second htaccess-log in : if I click Cancel instead of giving the htaccess-credentials for the second time, I get an Access denied from www.mysite.com.

    I’ve scanned my database dump, clear the cache (delete core/cache completely), scanned all modx files, but I can’t find anywhere a "www" prefix that could cause that redirection.

    Moreover, I’ve created some users with a redirection after login (with event onManagerLogin), and for those, I don’t need to htaccess-log in twice.
    I see that my hosting have some DNS configuration with www.mysite.com, and I’ve asked them if they could remove all www, but if it’s not possible, I would like to do it in modx.

    Thanks for your help.
      • 3749
      • 24,544 Posts
      This is a wild guess, but try uncommenting the rewrite rules in .htaccess that remove the "www" and put the login protection below that.
        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
        • 36225
        • 20 Posts
        I don’t see which line to uncomment as all are already uncommented?

        Here is my htaccess:

        RewriteEngine On
        RewriteBase /
        RewriteCond %{HTTP_HOST} .
        # Force all pages to go to www.domain.com for SEO
        RewriteCond %{HTTP_HOST} !^mysite.com [NC]
        RewriteRule (.*) http://mysite.com/$1 [R=301,L]
        # Friendly URLs
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
        ...
        AuthType Basic
        AuthName Restricted
        Require user myuser
        AuthUserFile /somewhere/.htpasswd
        
          • 3749
          • 24,544 Posts
          Another wild guess, but try adding a trailing slash to the URL:

          http://mysite.com/manager/

          With no slash, Apache tries to load a file called ’manager’ (after you give the password). When that fails, it tries to open a directory called ’manager’ and you have to give the password again.

            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