This usually can happen on a Linux server, after selecting wordpress option from Permalinks to view your postname in address bar.

Sure there is a solution to fix that.

1. Activate Mod_rewrites

Apache will have to generate the actual URL rewrites, we need to activate the apache mod_rewrite module that controls them:

sudo a2enmod rewrite

The command activates the module or—if it is already activated, displays the words, “Module rewrite already enabled

2. Create .htacess file

In your website main directory you’ll have to create a .htaccess file and add some lines in it:

sudo nano /var/www/YOURWEBSITE/.htaccess

Following to add in the document:

# 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

3. Permit .htacess file

sudo nano /etc/apache2/apache2.conf 

In the file find and change AllowOverride None  with  AllowOverride All

That’s all, now your website should work!


Leave a Reply