Wordpress permalinks 404 not found

久未见 提交于 2019-12-23 03:14:47

问题


i want to modify my permalink structure to a /%postname%/ to use Buddypress on a wordpress website server.

After some trial, i experiencing some trouble and even with my search in different forum, i don't know how to solve it.

My .htaccess permission is for the trial 666 so wordpress have to modify this file, but won't (last file modify at my server installation). In the database, the permalinks structure succesfully passed to %postname%.

Now, i have a 404 error in all pages i want to access.

.htaccess file :

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

# END WordPress

I running Apache, so to force the vars selection, i modified to this in the wp-include/vars.php :

//$is_apache = (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false || strpos($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') !== false);
$is_apache = 1;

What i have to do now ?

#

EDIT : I've reinstalled it, retry to do all of this, and same problem... Apache is owner of the file so i really don't understand...


回答1:


If you are able to access wp-admin panel then please try to update permalink structure to "Plain" and then check you are still getting 404 page error or not.




回答2:


Okay, i've solved the question.

The problem, and i haven't specified it in my problem explanation, is i use Virtualhost (i have too a monitoring website in this server so i wanted to separate all the task, logs etc...), and there is a problem with virtualhost and this instruction :

RewriteBase /

In fact, this work in normal apache environnment but not in virtualhost.

So what i had to do is to move my .htaccess content on the vhost conf.d file :

<VirtualHost *:80>
    ServerAdmin nfrbezar@vdbassocies.fr
    ServerName intranet.vdb.local
    ServerAlias intranet

    DocumentRoot /var/www/vhosts/intranet/html

    ErrorLog /var/www/vhosts/intranet/logs/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog /var/www/vhosts/intranet/logs/access.log combined

    <Directory "/">
       RewriteEngine On
       AllowOverride None
       Allow from 10.1.1.0/8

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

    </Directory>

</VirtualHost>

And by this way, it now work !

Sorry for not telling you that it was a virtualhost, i doesn't think it was important for the problem resolution, even if i supposed it was an apache problem.




回答3:


even I had the same issue when I deployed my wordpress site in aws ubuntu machine with apache server we have to add this lines in 000-default.conf if you have deployed your wordpress site in /var/www/html

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

then we have to restart apache server sudo service apache2 restart




回答4:


According to the Wordpress permission of.htaccess should be 604. Apply this permission and check it.

600 -rw-------  /home/user/wp-config.php
604 -rw----r--  /home/user/cgi-bin/.htaccess
600 -rw-------  /home/user/cgi-bin/php.ini
711 -rwx--x--x  /home/user/cgi-bin/php.cgi
100 ---x------  /home/user/cgi-bin/php5.cgi



回答5:


Also make sure that .htaccess with the necessary permissions is in /var/www/html even if the wordpress installation is on a different folder



来源:https://stackoverflow.com/questions/36330039/wordpress-permalinks-404-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!