Tag Archives: .htaccess file

Getting 404 Not Found after Permalink change

To allow the .htaccess file to override standard website configs, start by opening up the configuration file. NB: You will need sudo privileges for this step.  You may see a file in the sites-available directory for the website that you have created.  If this is the case, edit the file for your website rather than the default as shown in the example below.

sudo nano /etc/apache2/sites-available/default

Once inside that file, find the following section, and change the line that says AllowOverride from None to All. The section should now look like this:

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

After you save and exit that file, restart apache. .htacess files will now be available for all of your sites.

sudo service apache2 restart

WordPress Permalinks causing 403 Forbidden security problem when accessing all pages

I recently built this site on a little DigitalOcean.com “Droplet” server and went through the process of manually building a WordPress environment from scratch.  It was the first time that I have ever installed WordPress this way and on the whole it went very well.  Digital Ocean has published a number of excellent instructional “how-to” documents and the one I followed was “How to install WordPress on Ubuntu 14.04“.  The process went very smoothly right up to the point where I changed the Permalink setting so that the URL was build using the Page Name rather that the page number.  As soon as I did this the whole system locked up and I kept getting the “403 Forbidden” message no matter what I tried to do.

The problem came down to be the .htaccess file (which is a hidden file found in the root directory of the website) that is generated by WordPress when you make this Permalink change.  The generated .htaccess file is :

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

The solution came down to adding an extra line of code in the .htaccess file so that the final file looked like:

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

Once I added the “Options +FollowSymlinks” line the 403 Forbidden problem went away.

Copyright © 2024 WordpressNotes.org.