• Resolved rylan76

    (@rylan76)


    Hi guys

    I’ve spent a considerable amount of time trying to get any form of permalink working on WP 4.7.2 – my .htaccess in the same folder as my WP install’s index.php:

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

    My plugins:


    AddToAny Share Buttons
    Akismet
    Breadcrumb NavXT
    Contact Form 7
    Custom Icons by Stylemixthemes
    Disable Comments
    Duplicate Post
    Easy Table
    Force Regenerate Thumbnails
    Gravity Forms
    MailChimp for WordPress
    Page Links To
    Recent Tweets Widget
    Scalable Vector Graphics (SVG)
    Slider Revolution
    STM Importer
    STM Post Type
    TinyMCE Advanced
    Velvet Blues Update URLs
    WordPress Importer
    WP Google Map Plugin
    WP Google Map Pro
    WPBakery Visual Composer
    Yoast SEO

    All the plugins (according to WP’s plugin page) are up to date and current versions as of 2017-02-15.

    AllowOverride is set to ALL in my httpd.conf, and I’ve confirmed that the .htaccess is being parsed by Apache – putting something meaningless like “abc” into it crashes the server, so the Apache server instance on my box IS reading and parsing .htaccess as far as I can determine. I can put in rewrite rules that are applied consistently to test URLs I input into my web-browser.

    My PHP version is 5.6.29 on Centos 7 (fully updated via YUM as of 2016-02-15) on Apache 2.4.6.

    This is a WP install that has been running the past week with no problems, everything works fine, EXCEPT for any form of permalink.

    THE PROBLEM:

    Currently I have plain links activated (e. g. Settings->Permalinks is set on Plain) – everything works. I can go to the site, browse any page, all plugins work, and most functionality works.

    I can edit posts, create new ones, etc. etc.

    Now I want to start using Permalinks – however, the moment I select any of the other permalink options on the Settings->Permalinks page, the entire site stops working an I get 404 pages back no matter what page I try to access. Even the root landing page just gives a 404 error.

    The moment I return to plain links in Settings->Permalinks, all site feautures and functions start working fine once again.

    Things tried so far:

    – I have over and over and over insured that my .htaccess is writable, and being written by WP.
    – I can delete the .htaccess and see WordPress create it from scratch for me if I select a different permalink option.
    – I have modified the .htaccess WP creates with invalid rules, and it crashes the server reliably, indicating that the .htaccess WP creates IS being parsed and acted upon by my Apache instance.

    I’ve googled for about seven hours straight now, and the only summation of each of about 90 posts on the subject I pursued in various forums and blogs is always invariably that you either do not have a .htaccess, or it is not being read because AllowOverride is not set to “ALL” in httpd.conf, or WP cannot create it because your permissions are wrong on your WP directory.

    I’m reasonably sure the above is not my issue as I can crash my server by putting crap into .htaccess, indicating that the server does have AllowOverride set on my WP folder and it is reading my .htaccess. Also, I can delete the .htaccess and choose a permalink option in Settings->Permalinks, and I can ls -l in the WP folder and actually -see- WP create the .htaccess file it wants to use.

    I’ve also then chmod’ed this .httaccess file WP creates when I choose a permalink type to rwxrwxrwx (# chmod a+rwx .httaccess) to ensure everybody and anybody can read the file – even though Apache already DOES read, and act, on it) but no cigar.

    It seems WP 4.7.2 permalink functionality itself isn’t working for some reason, and that my Apache, PHP and Centos installs themselves are fine…

    I’ve also disabled all plugins and tried permalinks, same problem – the moment anything besides “plain” links is selected, the entire site dies (the admin backend still works though, allowing me to reset back to “plain” – and only THEN will the frontend again start working.)

    Where can I even begin to look?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Moderator t-p

    (@t-p)

    -Try resetting your custom permalinks back to the default setting and renaming your WordPress .htaccess file.
    – If that works, then try reading Using_Permalinks before setting a custom permalink structure again. If clearing your Permalinks does not alleviate the issue, this could be attributed to anything from a web server configuration to a bad WordPress install.

    This is something you can double-check before you tackle any php/apache configuration or possible missing dependency issues..

    AllowOverride is set to ALL in my httpd.conf,

    There’s more than one instance of AllowOverride in httpd.conf, only one controls what directives may be placed in .htaccess files. Make sure you’ve changed the correct one. Recheck to make sure the one you’ve changed is located beneath this heading:

    
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
        AllowOverride None
    

    ..an httpd restart is also required after making and saving any changes to the config file before they will take effect.

    Just one possibility, mind you.

    Thread Starter rylan76

    (@rylan76)

    Hi t-p

    Yup, done all that, I suspect my server is (somehow) incapable of hosting WordPress.

    I’m running stock Centos 7 yum insatlled Apache and PHP instances – any idea if stock standard Centos 7 PHP and Apache are in fact capable of running Wordpres 4.7.2?

    Thx

    Thread Starter rylan76

    (@rylan76)

    Hi Clayton

    Thx for the response. I’ve done a search of my httpd.conf and replace all lines I could find with the string AllowOverride to read AllowOverride All and restart apache.

    No luck on that, the problem remains exactly the same – any type of permalink using any tag / token, instantly takes the entire site offline and all pages just give 404 errors.

    Thx for the reply!

    any idea if stock standard Centos 7 PHP and Apache are in fact capable of running Wordpres 4.7.2?

    Absolutely.

    I have an installation of CentOS 7 right out of the box with httpd, PHP and MariaDB installed and it works fine.

    – I made only one edit to httpd.conf and that was the “AllowOverride All” I mentioned above.
    – I have WordPress installed in /var/www/html
    – I am not using virtual host configurations
    – I have SELinux disabled
    – Once WordPress was installed I set ownership on the the directory recursively to user:apache to avoid web server process/wordpress ownership issues when writing to files and directories.

    Example: chown -R username:apache /var/www/html

    This is about as vanilla as you can get on a test box, and permalinks worked with no additional effort.

    That being said, how you decide to run Apache and PHP, and whether or not you are using virtual host configurations is going to have a major impact on how you troubleshoot, but it isn’t WordPress related, It’s server configuration related.

    running httpd -M from a terminal will tell you if mod rewrite is actually loaded. The output should include something like – rewrite_module (shared) if its loaded. If not, start there. Otherwise go back over your application installation steps and your host configuration and file permissions and ownership schemes to see if you’ve overlooked something.

    Disclaimer: This is a test server, and not a live server, so your config will vary. Nothing I’ve mentioned about my test server config is intended as advice or for use in a production environment. It’s just a bare minimum of setup effort to illustrate that WordPress permalinks work properly on that OS.

    Thread Starter rylan76

    (@rylan76)

    Hi Clayton

    Thank you very much for the detailed reply and your time taken to respond.

    Ok, my status compared to your setup (differences in which I can then only logically conclude must be the differences that are breaking permalinks and everything dependent on them):

    – I have WP installed in var/www/html/live, not /var/www/html

    – All instances of the string “AllowOverride” in my httpd.conf read “AllowOverride All” – not just one. I started at the one defining /var/www/html, and when that didn’t work turned every AllowOverride to “all” for /var/www and for / too. Also tried turning it back with “AllowOverride all” only for /var/www/html still same problem.

    – I’m not using a virtual host as well, just the one site all alone on one Apache / PHP / MySQL setup, on one Linux server, freshly installed from a Centos 7 DVD image, and fully yum updated.

    – My SELinux is disabled with “SELINUX=disabled” in /etc/selinux/config

    – I had “user:user” permissions on /var/www/html, I changed this to “username:apache” and had WP rewrite the .htaccess, no luck. Permalinks still broken.

    – I ran “httpd -M | grep rewrite” and got back “rewrite_module (shared)” so mod_rewrite is loaded and apparently running. (I’m reasonably sure it is working, if I edit .htaccess and insert something meaningless like “abc” the server crashes with a 500 internal server error, indicating it IS reading and parsing the WP .htaccess.)

    I’ve been at this now for a total of about 17 hours cumulatively (just to get permalinks working) – as regards the permissions and installation steps I’ve rehashed those over and over, reinstalled, etc. – the site keeps on working in all combinations I’ve tried, just permalinks (and some stuff apparently depending on them, like the Gravity Forms) never, ever, work – no matter what we try.

    Its approaching the point where trying to host WordPress is just becoming too expensive, and other crucial stuff is falling behind.

    We’ll probably abandon it and go back something simpler to configure and set up. If you use something like JSP pages hosted on Jetty (Java) which I’m a bit more familiar with, in 17 hours I could have probably written something that can at least do the basics we want…

    I did think WP – being so common and popular – was a good alternative choice and would save time, its incredible popularity implying it is easy to use and setup – but clearly I was totally, utterly wrong in that assessment. Using WP is probably simple (I hope…) but -hosting- it and getting it into a working state in the first place is proving a practical impossibility (at least here.)

    Anyway, thank you VERY much for your kind assistance!

    Regards

    Stefan

    my .htaccess in the same folder as my WP install’s index.php:

    If you aren’t using virtual hosts, and you’ve installed wordpress in /var/www/html/live , then the .htaccess contents you posted don’t look right to me. It’s missing the sub-directory reference.

    It should probably look something like this:

    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /live/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /live/index.php [L]
    </IfModule>
    

    I think the .htaccess file contents you posted would probably only work if WordPress was running from the root directory (/var/www/html) otherwise… 404’s.

    Hi @rylan76,

    Were you able to find a solution to your problem?

    I think I have the same problem with permalinks.

    .htaccess is writable and/or WP can also create the file itself.
    I don’t have access to httpd.conf but my hosting admin confirmed that mod_rewrite and AllowOverride are active.
    He mentioned that I need to make sure that all my rules are apache 2.4 compliant.

    Looking for solutions as a noob WP user.

    p.s. problems started after I moved my files to a new server with a newer apache system.

    • This reply was modified 9 years, 1 month ago by halilcanatik.
    Thread Starter rylan76

    (@rylan76)

    Hi!

    Yes I managed to find a solution, but I’m not sure it is what you are looking for.

    Turns out my problem was that I placed my WordPress folder one folder too deep down the directory tree in my /var/www/html on the server.

    The site was developed by an outside company, and I wanted to place the site they developed for us in a seperate folder inside /var/www/html/ eg. I wanted to do this

    /var/www/html/the_site/index.php
    /var/www/html/the_site/wp-admin
    etc.

    and place the files in there.

    That broke my permalinks for some reason. Turned out when I placed the site here

    /var/www/html/

    and left everything as-is it started working perfectly.

    So the solution in my case was to place the entire wordpress codebase directly in

    /var/www/html/

    instead of trying to place it -anywhere- else on my Apache instance’s htdocs folder tree.

    Hope this helps.

    Regards

    Stefan

    Thread Starter rylan76

    (@rylan76)

    Also see Clayton James’ reply just above, that turned out to be exactly my problem. The sub-directory I had it in, instead of straight in /var/www/html.

    Hello,
    Thanks for your reply.

    I am not sure how but I solved my problem right after I asked you.

    I think I resetted the permalinks by switching to /%postname%/. Permalinks started to work. Now I am able to change it back to the old permalink rule that I was using.

    Probably missed something that I was supposed to do while migrating to new server.

    Best regards,
    Halilcan

    Moderator t-p

    (@t-p)

    Glad to know you got it sorted 🙂

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘Universal permalinks 404 failure (-NOT- due to my .htaccess?)’ is closed to new replies.