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

    Wordpress Links Breaking Website

    IT Discussion
    5
    14
    1.8k
    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.
    • thanksajdotcomT
      thanksajdotcom
      last edited by

      So I'm going to put this here so that it might help someone else. I tried changing the Permalinks format on my site from the default "?p=123" to anything else. Anytime I did, I got an error. Doing some research, I found I needed a .htaccess file, which wasn't being generated automatically. So I created it in vi and gave it permissions to be written to. I've tried this before though, and yet any non-default permalinks style breaks my site. I finally found the solution. In this link:
      http://wordpress.org/support/topic/solved-permalinks-working-in-apache2-ubuntu-1010#post-2421733

      Now the link has the right setting but that file didn't have what I needed. Using some powers of deduction, I went up a level and modified the apache2.conf file in /etc/apache2. If you go about 80% of the way down, you'll see (not gonna type everything):

      <Directory /var/www/>
      AllowOverride None
      </Directory>

      Now, there are multiple Directory containers so get the right one. Change None to All. After that, run service apache2 restart. I'm running Ubuntu Server 14.04 as a LAMP server, so, that's what I have to do. Basically, restart apache. After I did that, with my .htacess file in place, everything works! Hope this helps someone else!

      Thanks,
      A.J.

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

        You are missing the correct patterns in your .htaccess file.

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

          Example file:

          -bash-4.1$ cat .htaccess
          <IfModule mod_rewrite.c>
          RewriteEngine On
          RewriteBase /
          RewriteCond %{REQUEST_FILENAME} !-f
          RewriteCond %{REQUEST_FILENAME} !-d
          RewriteRule . /index.php [L]
          </IfModule>

          thanksajdotcomT 1 Reply Last reply Reply Quote 1
          • thanksajdotcomT
            thanksajdotcom @scottalanmiller
            last edited by

            @scottalanmiller said:

            Example file:

            -bash-4.1$ cat .htaccess
            <IfModule mod_rewrite.c>
            RewriteEngine On
            RewriteBase /
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule . /index.php [L]
            </IfModule>

            Those are automatically generated by Wordpress if the correct settings in Apache to AllowOverride are set correctly. As long as the Wordpress user has write permissions and Apache is right, that's auto-generated. It was because I just checked and that exact set of code is there. 🙂

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

              So your .htaccess file looks like that?

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

                @scottalanmiller said:

                So your .htaccess file looks like that?

                Correct. It's between a couple of comments that say WORDPRESS. It was automatically generated. Apache missing that setting was the issue. Wordpress is SUPPOSED to automatically generate it.

                1 Reply Last reply Reply Quote 0
                • MattKingM
                  MattKing @thanksajdotcom
                  last edited by

                  @ajstringham said:

                  So I'm going to put this here so that it might help someone else. I tried changing the Permalinks format on my site from the default "?p=123" to anything else. Anytime I did, I got an error. Doing some research, I found I needed a .htaccess file, which wasn't being generated automatically. So I created it in vi and gave it permissions to be written to. I've tried this before though, and yet any non-default permalinks style breaks my site. I finally found the solution. In this link:
                  http://wordpress.org/support/topic/solved-permalinks-working-in-apache2-ubuntu-1010#post-2421733

                  Now the link has the right setting but that file didn't have what I needed. Using some powers of deduction, I went up a level and modified the apache2.conf file in /etc/apache2. If you go about 80% of the way down, you'll see (not gonna type everything):

                  <Directory /var/www/>
                  AllowOverride None
                  </Directory>

                  Now, there are multiple Directory containers so get the right one. Change None to All. After that, run service apache2 restart. I'm running Ubuntu Server 14.04 as a LAMP server, so, that's what I have to do. Basically, restart apache. After I did that, with my .htacess file in place, everything works! Hope this helps someone else!

                  Thanks,
                  A.J.

                  I've honestly left my permalinks alone for the .htaccess reason; I'll have to check it out next time someone requests specific URL's! Thanks @ajstringham

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

                    Maybe it is Ubuntu doing something specific. It "just works" on CentOS.

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

                      @scottalanmiller said:

                      Maybe it is Ubuntu doing something specific. It "just works" on CentOS.

                      Oh shut up about CentOS. I saw people on CentOS having the exact same issue.

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

                        I've done a lot of CentOS setups of that and don't recall that coming up.

                        1 Reply Last reply Reply Quote 0
                        • thanksajdotcomT
                          thanksajdotcom
                          last edited by

                          Just ran into an issue where this wasn't working again. Solved by running...

                          sudo a2enmod rewrite
                          

                          Everything else was the same. Leaving this here as reference.

                          1 Reply Last reply Reply Quote 0
                          • ?
                            A Former User
                            last edited by

                            @thanksaj said:

                            sudo a2enmod rewrite

                            So it was your Apache config

                            JaredBuschJ thanksajdotcomT 2 Replies Last reply Reply Quote 1
                            • JaredBuschJ
                              JaredBusch @A Former User
                              last edited by JaredBusch

                              @thecreativeone91 said:

                              @thanksaj said:

                              sudo a2enmod rewrite

                              So it was your Apache config

                              Always has been in any issue like this that I have come across.

                              1 Reply Last reply Reply Quote 2
                              • thanksajdotcomT
                                thanksajdotcom @A Former User
                                last edited by

                                @thecreativeone91 said:

                                @thanksaj said:

                                sudo a2enmod rewrite

                                So it was your Apache config

                                I figured it was. I just couldn't find the solution. I'm documenting it here as much for myself for the possibility I need it again in the future as others.

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