Wordpress in root. PHP in subdirectory. htaccess help?

rknuppel

New member
Jun 12, 2009
4
0
0
I have a site with Wordpress in the root folder.

I have a subfolder called /directory/

The /directory folder has all PHP files that are not associated with Wordpress at all.

I have my directory working fine when I don't place a .htaccess file in the directory folder. So for instance, /directory/states.php?country=usa shows up and operates just fine. I created an htaccess folder hoping I could rewrite this to /directory/usa...

/directory/states.php?country=usa -> /directory/usa

I simply used this in my .htaccess file WITHIN my /directory folder:
--------------------------
RewriteEngine On

RewriteCond %{REQUEST_URI} ^/directory/
RewriteRule ^(.*) /directory/index.php [L]

RewriteCond %{REQUEST_URI} ^/directory/([a-z0-9,\_]+)
RewriteRule ^(.*) /directory/states.php?country=%1 [L]
---------------------------

This breaks all pages and gives the infamous "Internal Server Error" page.

Thoughts? How do I do this? I've done this several times on a site that didn't have Wordpress in the root. But now the wordpress .htaccess seems to be screwing it up or something.

Thanks in advance!
 


I've run into this b4.. It's a bitch. Some hosting i believe requires it to be in a public html or http docs folder. Ur on the right track and what ur doin makes sense. Just try a few dif places with the .htaccess and you'll get it. If you still can't figure it out. If i can remember more about it I'll update I'm pretty sure it's that the .htaccess needs to be in a publichtml so try making that in your /directory folder. Unfortunately for you the last site I had problems with this on was on a shitty hosting provider so we had the client seitch so I can't just go back and see how we fixed it.

Good luck
 
Try adding the following to the Wordpress htaccess file and remove the one from the sub-directory:

Code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

AFAIK it's basically saying don't rewrite URLs for files or directories that actually exist (such as those in the sub-directory).
 
I always keep my .htaccess file in the root html directory. You can still execute redirections for a sub directory from here.