1

I've set permalinks to /%postname%/, and have updated .htaccess in the root directory. The module rewrite is enabled on my machine (localhost). I can't think of any other reason why it's not working. Can anyone help me debug it?

Here's the logged error:

127.0.0.1 - - [22/Jan/2014:10:27:57 +0000] "GET /olp/about/ HTTP/1.1" 404 497 "http://localhost/olp/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.66 Safari/537.36"

Edit:

.htaccess:

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

WP is installed in localhost/olp, and .htaccess is in that same directory.

Edit: more info. In my apache2.conf, I've got:

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

Is this configuration correct?

babbaggeii
  • 7,577
  • 20
  • 64
  • 118

3 Answers3

3

This is now solved.

Although in apache.conf, I have AllowOverride All, this wasn't set in /etc/apache2/sites-available/default. There it had AllowOverride None. So I just changed this, restarted apache and now it works.

babbaggeii
  • 7,577
  • 20
  • 64
  • 118
  • Glad it's resolved! So you just enabled the .htaccess override from the specified file and it works now with the .htaccess contents you posted, could you please confirm, thanks? – Minister Jan 22 '14 at 16:35
  • 1
    I had the opposite problem where it was 'AllowOverride All' in 'sites-available' but was set to 'None' in 'apache2.conf' – chow Feb 24 '19 at 00:41
0

You may need to copy the index.php (or you may first try to skip this one) and the .htaccess from /localhost/olp to /localhost/ dir.

This advice is according the docs at: http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

Usually it is needed when you install it in /localhost and move it to /localhost/olp. But I'm not experienced in installing WP in a subdirectory.

Another similar questions are available:

Make sure your .htaccess works!

And a final tip - as it is a localhost installation, you probably can install it directly in the main document root (then I can help much more).

Community
  • 1
  • 1
Minister
  • 1,198
  • 2
  • 10
  • 18
  • I can't copy index.php and .htaccess to the www root directory because I've got several installs, all under that root. – babbaggeii Jan 22 '14 at 11:26
  • If you are sure your .htaccess works, then you should at least test something, but the first one is to make sure your .htaccess from /localhost/olp is working! – Minister Jan 22 '14 at 11:30
  • Ask google: how to test .htaccess is working (also check your OS - Win/Linux/Mac... your web server - apache, nginx...) – Minister Jan 22 '14 at 11:36
  • This didn't work for me. It also seems like moving `.htaccess` and `index.php` into the parent directory defeats the purpose of keeping the project in a subdirectory, or at least my purpose, which is to be able to switch among multiple WP projects. – Jason Swett Nov 14 '18 at 20:55
0

Try to clear-up your .htaccess file and than save permalinks again in wp-admin, wordpress will add Rewrite to .htaccess, sometimes it's helping.

het0
  • 86
  • 1
  • 7