WordPress – Subdirectory – htaccess

I have WordPress installed in a subdirectory:

/public_html/blog/

I want to be able to access the blog like this:

Read More
http://example.com/blog

and posts like this:

http://example.com/blog/category/postname

In general settings I have the “WordPress Address (URL)” set to:

http://example.com/blog

Permalinks is set like:

/blog/%category%/%postname%

In the subdirectory (/public_html/blog/) I have an .htaccess like:

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

Everything works EXCEPT for being able to access the blog Home page at:
http://www.example.com/blog
Doing that sends me to the “WordPress 404 page not found” page.

I’d be very grateful for a solution!

EDIT

I’m an idiot – I missed something vital. I needed to also change the Site URL in WordPress > General to:

http://example.com/blog

Doing that and then removing /blog/ from the permalink structure made everything work. I probably wouldn’t have spotted this if @IanB hadn’t picked up the /blog/ bit not being necessary. Thanks…

Related posts

Leave a Reply

1 comment

  1. 2 things come to mind.
    I don’t think you need to add /blog/ in your permalink structure, (unless wordpress is adding that for you). That should be automatic if that is the file it is installed in.

    Also,
    Where is your index.php file for your wordpress install – Is it in the blog folder or in the /public_html/ folder.

    If you want to display the blog at http://example.com/blog it should be in the blog folder.

    What is the filepath you use to log in? Does that work fine?