How to fix the 404 error page when clicking on a link in wordpress

If you are like me, you probably prefer to setup everything by hand. In my situation, when I tried to change my permalinks to a specific structure, I was unable to access any article or link ; a apache 404 error always occured for no apparent reason.

My wordpress installation was configured this way :

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

The whole wordpress folder is owned by the server process.

How to solve this shit

To solve this issue I had to :

  • First put a .htaccess file in your /var/www/ folder and make it writable.

Then, suppose your wordpress blog is in /var/www/wordpress folder then go to /etc/apache2/sites-available/ and add the following changes in default file:

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

Restart apache and it should solve the whole issue.

EDIT :

If it didn’t change anything, be sure that your .htaccess from these 2 lasts folders are both writable by your web server service and that they both contain these lines :

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

If you keep having troubles, don’t hesitate to ask for help in the comment section.

Leave a Reply

Your email address will not be published. Required fields are marked *