views:

483

answers:

2

Hello, We have a WP install in the root of our server and its running great.. but, we just installed another app in a subdomain. Now, I can view the index.php of that app but cannot do anything with it.. the htaccess rules in the root (from WP base install) are effecting the requests.

So, how to I eliminate the WP htaccess file from effecting the subdomain?

Here is the htaccess contents for the root (WP install):

<IfModule mod_rewrite.c>
RewriteEngine On
# BEGIN WordPress
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
</IfModule>

And for the htaccess in the subdomain:

RewriteEngine on
RewriteCond $1 !^(index\.php|css|stylesheets|js|images|user_guide|favicon\.ico|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

I've search everywhere online and tried a couple samples I found.. nothing has worked.

Any help is greatly appreciated ! Thanks

UPDATE: It seems that maybe Wordpress is not the culprit.. out of curiosity, I removed all lines in the WP .htaccess file.. and the app in the subdomain was still not working. Its rewrite rule must be wrong..

So, it is the second rewrite rule that is not working. If I type in /index.php?about then I can see the about page.. but it should display by going to: /about

+2  A: 

WP is also the culprit (you have two problems).

I can fix the first .htaccess problem because WP is predictable. You want to put this before the BEGIN WordPress section:

RewriteRule ^subdir-name/.*$ - [PT]

That grabs any requests to your subdir and Passes it Through (PT) so that it is not hijacked by WordPress.

The problem in your second .htaccess is that it seems to be assuming it is still in the root directory. For this one, I can't be sure without seeing the layout of your app, but the / before index.php may well be wrong. Are you sure that the paths in the second file match the new layout of your files?

Nicholas Wilson
Excellent.. thanks. Right before I saw your answer (haven't tested it yet) I kept trying everything I read online and this seems to work for any sub-dirs I need to work properly:# stuff to let through (ignore)RewriteBase /RewriteCond %{REQUEST_URI} "/sub-dir1/" [OR]RewriteCond %{REQUEST_URI} "/sub=dir2/"RewriteRule (.*) $1 [L]
revive
Yes, you can use RewriteConditions. Some people have very complicated .htaccess files though (which can be a good thing; they are better for dealing with many sorts of things than PHP handling some people use), and using RewriteConds will be more fiddly if you have lots of different blocks of rules to deal with. PT is the 'right' way to deal with it, though not the only way.
Nicholas Wilson
Thanks again! Is there anyway to bump a point for this answer - I cannot vote until I get to 15 points!!! LAME !
revive
A: 

Um... should this work? For sub-directory "office" - cheers :-)

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^office/.*$ - [PT]
# BEGIN WordPress
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
</IfModule>
Gwilym