only default permalinks working wordpress others become 404 error

前端 未结 6 883
夕颜
夕颜 2020-12-11 23:21

My problem is in my wordpress site only default permalinks is working.. When I change permalinks all pages become not found.. only home page is showing.

When I chang

相关标签:
6条回答
  • 2020-12-12 00:05

    It could be a broken rewrite_rules field in your database.

    I installed "Yoast SEO" into a live site and that broke it completely. I disabled the plugin but it didn't go back to working. Only default permalinks would work.

    Like everyone else I tried the usual things - checking .htaccess, making sure that mod_rewrite was working on the server, saving the permalinks settings again, but nothing was working. The homepage would load, and wp-admin pages would load, but everything else was just loading the "Latest Posts" default page.

    In the end it turned out to be something wrong with the rewrite_rules field of wp_options in the database.

    I had three versions of the site (local, staging and production), and all were from one SVN base, so I knew it was not a file issue. But only the local development version was working.

    I replaced the contents of the rewrite_rules field of the broken live site with the working one from my local development site, and it worked.

    What's really weird is that deleting the rewrite_rules field and having WordPress rebuild it did not fix the problem. Only replacing with the contents of a previously working version of the site did the trick.

    I'm still puzzled by this, and will edit this reply if I find out anything further about the problem.

    0 讨论(0)
  • 2020-12-12 00:10

    Not sure this is too late. i faced the same issue and solved by changing

    AllowOverride None
    

    to

    AllowOverride All
    

    in /etc/apache2/sites-enabled/000-deafult.conf file. hope this would help.

    0 讨论(0)
  • 2020-12-12 00:11

    suffered from the same issue. Having site on SSL had to change NOT the 000-default.conf but the respective SSL conf file. Adding

    after DocumentRoot /var/www/html

    the following
    
    <Directory "/var/www/html">
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
    </Directory>
    

    and then restarting apache2 saved my site.... nothing else worked. The issue was Wordpress SSL and SEO plugins messing up config files.

    0 讨论(0)
  • 2020-12-12 00:13

    I had this issue in Wordpress installed on CentOS7 and the solution was to edit httpd.conf file with this command:

    sudo vi /etc/httpd/conf/httpd.conf
    

    And replace

    <Directory "/var/www/wordpress">
    Options Indexes FollowSymLinks
    AllowOverride none
    Require all granted
    </Directory>
    

    with

    <Directory "/var/www/wordpress">
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
    </Directory>
    

    then restart Apache:

    sudo systemctl restart httpd.service
    
    0 讨论(0)
  • 2020-12-12 00:24

    I had the exact same issue and fixed it by running

    sudo a2enmod rewrite
    

    Then restarted apache. Apparently the issue is caused by mod_rewrite potentially not working properly on ubuntu.

    I found the solution here

    0 讨论(0)
  • 2020-12-12 00:26

    In case you are on Ubuntu, edit the file /etc/apache2/apache2.conf (here we have an example of /var/www):

    <Directory /var/www/>
            Options Indexes FollowSymLinks
            AllowOverride None
            Require all granted
    </Directory>
    

    and change it to:

    <Directory /var/www/>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
    </Directory>
    

    also check Apache configuration file for your website /etc/apache2/sites-available/your_site.conf:

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

    and change it to:

    <Directory /var/www/your_site_path/>
        AllowOverride All
    </Directory>
    

    You need to do sudo a2enmod rewrite to enable module rewrite

    then,

    sudo service apache2 restart

    I hope this helps you!

    0 讨论(0)
提交回复
热议问题