“File does not exist” error on mod_rewrite (WordPress permalink)

I’m trying to configure WordPress permalinks on Linode server running Ubuntu. The permalinks are not working even after doing the basic tricks for configuring them.

.htaccess -file has been given permission “777” and WP has rewritten it:

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

# END WordPress

I have configured “etc/apache2/sites-available/default in a following way:

DocumentRoot /var/www
<Directory />
   Options FollowSymLinks
       AllowOverride ALL
</Directory>
   <Directory /var/www/>
       Options Indexes FollowSymLinks MultiViews
       AllowOverride ALL
       Order allow,deny
       allow from all
   </Directory>
   <Directory /var/www/mydomin.com/public_html/mydirectory/>
      RewriteEngine On
      AllowOverride ALL
   </Directory>

As you can see I’ve tried to set “AllowOverride” to different folders. I just gave it a shot, thought that maybe something is overriding the rule for certain folders.

I have ran “a2enmod rewrite” command on Terminal and mod_rewrite is enabled.

I have restarted my Apache every time I’ve made changes.

When I navigating on my WordPress site I get “Page not found” error. Apache error log says following:

File does not exist: /var/www/mydomain.com/public_html/mydirectory/mysubdirectory/

What am I missing here?

Related posts

Leave a Reply

1 comment

  1. The below settings can go in your VirtualHost directive for the site in question. In most cases this is located in a separate file and referenced from the main conf file for the server.

    RewriteEngine On
    AllowOverride ALL
    

    Generally speaking you want to keep all of the settings for each site in their own file. So if you need to tweak anything else do it in the file containing the VirtualHost directive for that site. It makes it much easier to troubleshoot/maintain in the future.