ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Solved WordPress Cutover Main Page Works, but Secondary Pages Do Not

    IT Discussion
    wordpress cloudflare nginx varnish apache php ubuntu linux ubuntu 19.04
    8
    19
    1.5k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • scottalanmillerS
      scottalanmiller
      last edited by

      So this is odd, I have a WordPress site that I am moving from one server to another. It's essentially a straight move, nothing to weird. The old server is straight Apache and the new one has a Varnish cache and an nGinx reverse proxy in front of it. If we do the move the landing page works great in both cases. But after moving additional pages like "about us" no longer work, they go nowhere as if there was no such link. It seems like unlikely behaviour, I'm trying to think of why this might happen. Where should I be looking (other than the logs which I am off to dig into now.)

      dafyreD Emad RE 2 Replies Last reply Reply Quote 0
      • scottalanmillerS
        scottalanmiller
        last edited by

        BANGING HEAD ON DESK

        It's an Ubuntu-ism. On Fedora this is not needed. On Ubuntu you have to...

        a2enmod rewrite
        
        dbeatoD ObsolesceO 1 travisdh1T 4 Replies Last reply Reply Quote 5
        • dafyreD
          dafyre @scottalanmiller
          last edited by

          @scottalanmiller said in WordPress Cutover Main Page Works, but Secondary Pages Do Not:

          So this is odd, I have a WordPress site that I am moving from one server to another. It's essentially a straight move, nothing to weird. The old server is straight Apache and the new one has a Varnish cache and an nGinx reverse proxy in front of it. If we do the move the landing page works great in both cases. But after moving additional pages like "about us" no longer work, they go nowhere as if there was no such link. It seems like unlikely behaviour, I'm trying to think of why this might happen. Where should I be looking (other than the logs which I am off to dig into now.)

          • Did you copy the database & files from the new server?
            -- If not, then check and make sure you have pretty URLs turned on in WP.
            -- If you did, then check and make sure you have a working .htaccess file
            -- Also check and make sure AllowOverride is set correctly.

          • Does the new server have the same URL?

          scottalanmillerS 4 Replies Last reply Reply Quote 0
          • scottalanmillerS
            scottalanmiller @dafyre
            last edited by

            @dafyre said in WordPress Cutover Main Page Works, but Secondary Pages Do Not:

            Did you copy the database & files from the new server?

            Yes, and they are working. WordPress runs.

            1 Reply Last reply Reply Quote 0
            • scottalanmillerS
              scottalanmiller @dafyre
              last edited by

              @dafyre said in WordPress Cutover Main Page Works, but Secondary Pages Do Not:

              If you did, then check and make sure you have a working .htaccess file

              It's the same one that was working before, as it was copied. However, the new server has those new caches, so could they be messing with it?

              1 Reply Last reply Reply Quote 0
              • scottalanmillerS
                scottalanmiller @dafyre
                last edited by

                @dafyre said in WordPress Cutover Main Page Works, but Secondary Pages Do Not:

                Does the new server have the same URL?

                Yes

                1 Reply Last reply Reply Quote 0
                • scottalanmillerS
                  scottalanmiller
                  last edited by

                  Definitely whatever is happening, it is not even trying to hit the WP application. The server reacts totally differently if I hit the root and it processes the request, or if I don't, it's an instant fail.

                  1 Reply Last reply Reply Quote 0
                  • scottalanmillerS
                    scottalanmiller @dafyre
                    last edited by

                    @dafyre said in WordPress Cutover Main Page Works, but Secondary Pages Do Not:

                    Also check and make sure AllowOverride is set correctly.

                    Sure seems to be.

                    1 Reply Last reply Reply Quote 0
                    • scottalanmillerS
                      scottalanmiller
                      last edited by

                      BANGING HEAD ON DESK

                      It's an Ubuntu-ism. On Fedora this is not needed. On Ubuntu you have to...

                      a2enmod rewrite
                      
                      dbeatoD ObsolesceO 1 travisdh1T 4 Replies Last reply Reply Quote 5
                      • dbeatoD
                        dbeato @scottalanmiller
                        last edited by

                        @scottalanmiller said in WordPress Cutover Main Page Works, but Secondary Pages Do Not:

                        BANGING HEAD ON DESK

                        It's an Ubuntu-ism. On Fedora this is not needed. On Ubuntu you have to...

                        a2enmod rewrite
                        

                        Yup, even for enabling PHP too...

                        1 Reply Last reply Reply Quote 0
                        • ObsolesceO
                          Obsolesce @scottalanmiller
                          last edited by

                          @scottalanmiller said in WordPress Cutover Main Page Works, but Secondary Pages Do Not:

                          BANGING HEAD ON DESK

                          It's an Ubuntu-ism. On Fedora this is not needed. On Ubuntu you have to...

                          a2enmod rewrite
                          

                          What's that?

                          1 scottalanmillerS 2 Replies Last reply Reply Quote 0
                          • 1
                            1337
                            last edited by 1337

                            You should look at the mod_rewrite rules. It's pretty obvious that the problem lies with the url rewriting.

                            Either the reverse proxy is wrongly configured or the apache webserver.

                            Actually it's probably best to follow the entire chain. Remember that you can active the rewrite modules logging as well.

                            A small thing like using a different directory will make the rewrite rules invalid.

                            1 Reply Last reply Reply Quote 0
                            • 1
                              1337 @Obsolesce
                              last edited by

                              @Obsolesce said in WordPress Cutover Main Page Works, but Secondary Pages Do Not:

                              @scottalanmiller said in WordPress Cutover Main Page Works, but Secondary Pages Do Not:

                              BANGING HEAD ON DESK

                              It's an Ubuntu-ism. On Fedora this is not needed. On Ubuntu you have to...

                              a2enmod rewrite
                              

                              What's that?

                              That's a script that enables the mod_rewrite module in apache - apache2 enable module.

                              1 Reply Last reply Reply Quote 2
                              • scottalanmillerS
                                scottalanmiller @Obsolesce
                                last edited by

                                @Obsolesce said in WordPress Cutover Main Page Works, but Secondary Pages Do Not:

                                @scottalanmiller said in WordPress Cutover Main Page Works, but Secondary Pages Do Not:

                                BANGING HEAD ON DESK

                                It's an Ubuntu-ism. On Fedora this is not needed. On Ubuntu you have to...

                                a2enmod rewrite
                                

                                What's that?

                                It's what enables rewrite to work at all.

                                1 Reply Last reply Reply Quote 1
                                • Emad RE
                                  Emad R @scottalanmiller
                                  last edited by Emad R

                                  @scottalanmiller

                                  Ok ensure .htaccess file is present and has good permission

                                  try chmod something open to the docroot and chown like www-data:www-data for whole docroot just for test

                                  Use wordpress cli to change the site URL home and URL address to the correct values after site move
                                  define( 'WP_HOME', 'http://example.com' );
                                  define( 'WP_SITEURL', 'http://example.com' )

                                  You can use the portable phar
                                  https://gist.github.com/pcsontos/122fceb3d6e6e43da98d
                                  wp-cli.phar option update home 'http://example.com'
                                  wp-cli.phar option update siteurl 'http://example.com'

                                  1 Reply Last reply Reply Quote 0
                                  • 1
                                    1337 @scottalanmiller
                                    last edited by

                                    @scottalanmiller said in WordPress Cutover Main Page Works, but Secondary Pages Do Not:

                                    BANGING HEAD ON DESK

                                    It's an Ubuntu-ism. On Fedora this is not needed. On Ubuntu you have to...

                                    a2enmod rewrite
                                    

                                    Ah, so the problem was just that the mod_rewrite module wasn't enabled in Apache.

                                    It's the LoadModule entries in the httpd.conf file that tells Apache which modules to load. Using a2enmod is mostly for convenience.

                                    scottalanmillerS 1 Reply Last reply Reply Quote 0
                                    • travisdh1T
                                      travisdh1 @scottalanmiller
                                      last edited by

                                      @scottalanmiller said in WordPress Cutover Main Page Works, but Secondary Pages Do Not:

                                      BANGING HEAD ON DESK

                                      It's an Ubuntu-ism. On Fedora this is not needed. On Ubuntu you have to...

                                      a2enmod rewrite
                                      

                                      Gotta love those Ubuntu-isms that exist just to slow us down. You all know how much I like Ubuntu.

                                      dbeatoD 1 Reply Last reply Reply Quote 0
                                      • scottalanmillerS
                                        scottalanmiller @1337
                                        last edited by

                                        @Pete-S said in WordPress Cutover Main Page Works, but Secondary Pages Do Not:

                                        @scottalanmiller said in WordPress Cutover Main Page Works, but Secondary Pages Do Not:

                                        BANGING HEAD ON DESK

                                        It's an Ubuntu-ism. On Fedora this is not needed. On Ubuntu you have to...

                                        a2enmod rewrite
                                        

                                        Ah, so the problem was just that the mod_rewrite module wasn't enabled in Apache.

                                        It's the LoadModule entries in the httpd.conf file that tells Apache which modules to load. Using a2enmod is mostly for convenience.

                                        Right, coming from doing this in Fedora regularly, it didn't occur to me that there was a manual step as Fedora defaults to turning that on.

                                        1 Reply Last reply Reply Quote 0
                                        • dbeatoD
                                          dbeato @travisdh1
                                          last edited by

                                          @travisdh1 said in WordPress Cutover Main Page Works, but Secondary Pages Do Not:

                                          @scottalanmiller said in WordPress Cutover Main Page Works, but Secondary Pages Do Not:

                                          BANGING HEAD ON DESK

                                          It's an Ubuntu-ism. On Fedora this is not needed. On Ubuntu you have to...

                                          a2enmod rewrite
                                          

                                          Gotta love those Ubuntu-isms that exist just to slow us down. You all know how much I like Ubuntu.

                                          We know 😉 but hey I know it 😛

                                          1 Reply Last reply Reply Quote 1
                                          • CloudKnightC
                                            CloudKnight
                                            last edited by

                                            Well let's talk about fedora and updating killing a laptop lol....

                                            1 Reply Last reply Reply Quote 0
                                            • 1 / 1
                                            • First post
                                              Last post