We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26016
    • 561 Posts
    Hi!
    Here’s a brainteaser for you. I have a site that’s working great except for one odd thing. If I go to the homepage URL using "www" at the beginning, I get the 404 not found page (showing up in content area, headers/footers/menu are fine). All other links work fine. BTW, if I explicitly type out the full homepage URL (as opposed to just the domain), the homepage comes up OK.

    Here’s another oddity, if I log into the manager using "www" at the beginning, I get in fine, but then when I go to edit a page, I get "you don’t have enough privileges for this action".

    I am using friendly URL’s. It may or may not be related to the problem. My sites are running on Linux with Apache. I have a bunch of other MODx sites on the same box that don’t have this problem. As far as I can see, their MODx configs are the same, except for file paths, of course.

    I have standard stuff in each .htaccess to get the FURL’s working:
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]

    Oddly enough, every part of the site, including home and manager editing, works fine if I avoid using "www" at the beginning. Weird, isn’t it? Even weirder, this problem appeared suddenly after the site had been working great for a long time. Something happening on the server? Maybe, but all my other sites on this box are still perfect. Go figure.

    I’m hoping one of you geniuses will have an idea!

    Thanks!
    Samba
      MODx and Wordpress development
      Linux, PHP 5.2, MySQL 5.0, Evo 1.05, Revo 2.08-pl, Firefox 4
      • 16173
      • 14 Posts
      Maybe you should redirect yoursite.com to www.yoursite.com?
      I always do that when I get a new domain name.
        • 26016
        • 561 Posts
        Quote from: KomsBomb at Oct 24, 2007, 08:22 PM

        Maybe you should redirect yoursite.com to www.yoursite.com?
        I always do that when I get a new domain name.

        Thanks for the idea. But if I redirect to www.yoursite.com, that triggers the problem... I get the 404 on the root.

        I actually can do the opposite, and the whole thing works. That is, I can redirect all www.yoursite.com/blahblah to yoursite.com/blahblah. I know how to do that thru htaccess.

        But I would like to find out is why this is happening (and why my other sites are OK). Maybe someone smarter than I am has run into this and will know.

        Thanks, Samba
          MODx and Wordpress development
          Linux, PHP 5.2, MySQL 5.0, Evo 1.05, Revo 2.08-pl, Firefox 4
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          I believe this to be an issue with your server’s configuration. According to Apache docs
          For example, suppose that you are serving the domain www.domain.tld and you wish to add the virtual host www.otherdomain.tld, which points at the same IP address. Then you simply add the following to httpd.conf:

          NameVirtualHost *

          <VirtualHost *>
          ServerName www.domain.tld
          DocumentRoot /www/domain
          </VirtualHost>

          <VirtualHost *>
          ServerName www.otherdomain.tld
          DocumentRoot /www/otherdomain
          </VirtualHost>

          You can alternatively specify an explicit IP address in place of the * in both the NameVirtualHost and <VirtualHost> directives. The IP address is required in version 1.3.12 and earlier.

          Many servers want to be accessible by more than one name. This is possible with the ServerAlias directive, placed inside the <VirtualHost> section. For example if you add this to the first <VirtualHost> block above

          ServerAlias domain.tld *.domain.tld

          then requests for all hosts in the domain.tld domain will be served by the www.domain.tld virtual host. The wildcard characters * and ? can be used to match names. Of course, you can’t just make up names and place them in ServerName or ServerAlias. You must first have your DNS server properly configured to map those names to an IP address associated with your server.

            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
            • 26016
            • 561 Posts
            Quote from: sottwell at Oct 24, 2007, 10:01 PM

            I believe this to be an issue with your server’s configuration. According to Apache docs
            Susan,
            As always, you’re the greatest! I suspected something like that might be awry. After doing designing and programming, I am only now grasping things down at the server level. The only thing I’ve ever done with Apache is a restart. I’ve never touched the conf file, but why not? I’ll look into it.

            Some of the sites do share an IP, which definitely lends credence to your thoughts. What’s kind of scary is that the site had previously stopped working with "www", but then it suddenly worked again for awhile. To me, that also points to something at the server level.

            It does seem so odd that before, everything on the site worked except the root, but that’s probably because of the more explicit URL’s for the other pages. And the fact that I could log in fine, but that I suddenly wasn’t able to edit pages, was freaky.

            For now, I’ve done a hard redirect to remove "www", and I’ve tweaked other scripts that busted because they had "www" in their configs, so they’re working, too. All fixed! I will continue my research into the Apache config when I actually have some time. grin

            Thanks again for your help!!!!!
            Samba
              MODx and Wordpress development
              Linux, PHP 5.2, MySQL 5.0, Evo 1.05, Revo 2.08-pl, Firefox 4
              • 26016
              • 561 Posts
              Hi Friends,
              As I said above, I used .htaccess to remove "www" from incoming links. That got rid of my homepage 404, and the whole site displays fine.

              But now my MODx Manager no longer works. I can log in, but get "you don’t have enough privileges for this action" when trying to edit a page.

              Before I made this change, when using "www" in URL’s I could edit stuff OK with the Manager, but got the homepage 404.

              I suppose I could use yet another .htaccess to force "www" on the Manager area. Maybe, as Susan said, I’m forced to mess with Apache’s httd.conf. Any thoughts?

              Thanks,
              Samba
                MODx and Wordpress development
                Linux, PHP 5.2, MySQL 5.0, Evo 1.05, Revo 2.08-pl, Firefox 4
                • 26016
                • 561 Posts
                Quote from: samba at Oct 26, 2007, 10:00 AM

                Hi Friends,
                As I said above, I used .htaccess to remove "www" from incoming links. That got rid of my homepage 404, and the whole site displays fine.

                But now my MODx Manager no longer works. I can log in, but get "you don’t have enough privileges for this action" when trying to edit a page.

                Before I made this change, when using "www" in URL’s I could edit stuff OK with the Manager, but got the homepage 404.

                I suppose I could use yet another .htaccess to force "www" on the Manager area. Maybe, as Susan said, I’m forced to mess with Apache’s httd.conf. Any thoughts?
                Hi, All,
                Some folks kindly helped me out with ideas on what was causing this. Along with driving you nuts, I also contacted the host’s tech support for help. He could not find a 404 problem, and he had the good sense to ask me what browser I was using. I use FF as my regular choice, and IE6 only for testing. So I still got 404 on Firefox 2, but IE6 did not! (yes, that’s actually me making a positive comment about IE6). He also used FF 2, and no 404! So I just said, well, the site’s working, so I guess I’ll just leave it for now.

                I was thinking about this today. Why would only my own FF browser not work? Suddenly it dawned on me to kill my cookies for that site. Boom, 404 problem instantly fixed!!!!!. Best of all, no errors with edit permissions in the Manager! I’m happy, but also hanging my head in shame for wasting people’s time.

                I suppose that I didn’t think of cookies before because the 404 problem would happen whether logged into manager or not. I also had tried hard refreshes. So I have some cookie problems, but that’s a lot more minor than having visitors getting 404! On the bright side, I’m getting a lot more knowledgeable about .htaccess and its relatives. And after looking further, it may not even be the MODx cookie, but possibly one set with another script installed under the same URL.

                Thanks again to everybody here, the Best Community Around!!!!
                Samba
                  MODx and Wordpress development
                  Linux, PHP 5.2, MySQL 5.0, Evo 1.05, Revo 2.08-pl, Firefox 4