user5456337
user5456337

Reputation:

Wordpress (Postname Permalink) 404 error

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

Upvotes: 0

Views: 1535

Answers (4)

john heroi
john heroi

Reputation: 47

My .htaccess file was set correct beforehand, so changing the file contents wouldn't help. On my Ubuntu server I tried:

sudo apt update
sudo apt upgrade

Afterwards it worked.

Upvotes: 0

Aashish Kaushik
Aashish Kaushik

Reputation: 460

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

Upvotes: 3

Domain
Domain

Reputation: 11808

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.

Upvotes: 0

Prabin Parajuli
Prabin Parajuli

Reputation: 561

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.

Upvotes: 0

Related Questions