Wordpress (Postname Permalink) 404 error

2019-09-09 21:35发布

I have a problem with my Wordpress permalink. I tried to change permalink to postname "/%postname%/". When I test one of my page, its says that 404 Not Found.

I've looking around about my problem and tried many tutorials but no luck. In my opinion, my Wordpress access seems not working but I'm not sure because I'm newbie for this. Please anyone can help me solve this problem.

Thanks In Advance

标签: wordpress
3条回答
Viruses.
2楼-- · 2019-09-09 21:50

Please check you .htaccess must look like below if not remove all code and write below:

    # 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

After that run below command:

1 EDIT (Change None to all) sudo vim /etc/apache2/apache2.conf

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

To (press i to edit)

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

save (press :wq!)

  1. sudo a2enmod rewrite

  2. sudo service apache2 restart

查看更多
男人必须洒脱
3楼-- · 2019-09-09 21:56

Try replacing your .htaccess with default .htaccess

# 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

Make sure you backup your .htaccess before using this.

查看更多
可以哭但决不认输i
4楼-- · 2019-09-09 22:02

If your .htaccess file were writable, WordPress will do this automatically, but if it isn't- these are the mod_rewrite rules you should add in your .htaccess file.

1- Open .htaccess file and copy the following data in that file.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
  1. After updating the file the permalink issue will resolve.
查看更多
登录 后发表回答