views:

21

answers:

2

My site is a php based site, but I've added wordpress in a /blog/ folder. The .htaccess file below should allow the /blog/ folder to be accessed, but I get a 404 error saying that blog.php doesn't exist.

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{SCRIPT_FILENAME}  !\.(gif|jpg|png)$
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)/(.*)/$ /$1_$2.php [L]
    RewriteRule ^(.*)/$ /$1.php [L]
</IfModule>

Anybody able to help at all?

+1  A: 

The last RewriteRule is redirecting your request to /blog/ to index.php, you should add a RewriteCond to check if the request is on the blog folder.

RewriteCond %{REQUEST_URI} !^/blog/.*
Aistina
thanks for the response. My understanding is that the conditionals I've got in there should mean it never gets to the rewrite rule if the file/folder exists. Obviously this isn't the case, do you know why?In any case I get the following when using your addition:[code]The requested URL /blog.php was not found on this server.[/code]
Simon Stevens
A: 

I managed this using the code below, for some reason the conditionals that were suggested don't work (I HATE .htaccess)

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteRule ^(blog) - [L]
    RewriteCond %{SCRIPT_FILENAME}  !\.(gif|jpg|png)$
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)/(.*)/$ /$1_$2.php [L]
    RewriteRule ^(.*)/$ /$1.php [L]
</IfModule>
Simon Stevens