I'm having a few issues getting rewrite rules for a specific subdirectroy (different from the webroot) and I'm at a loss as to where to put them.
/var/www/ (webroot containing WordPress) /var/www/subdirectory (containing other app which requires it's own rewrite rules)
The below rules I for WordPress which is in the webroot dir (/var/www, or http://mywebsite.com):
$HTTP["host"] =~ "mywebsite.com" {
url.rewrite-final = (
# Exclude some directories from rewriting
"^/(wp-admin|wp-includes|wp-content|gallery2)/(.*)" => "$0",
# Exclude .php files at root from rewriting
"^/(.*.php)" => "$0",
# Handle permalinks and feeds
"^/(.*)$" => "/index.php/$1"
)
}
Then I have a second app that sits in a subdirectory of the webroot (/var/www/subdirectory, or http://mywebsite.com/subdirectory) with the following rules:
url.rewrite = (
"(index.php|test.php|favicon.ico)" => "/$1",
"(css|files|img|js)/(.*)" => "/$1/$2",
"^([^\?]*)(\?(.+))?$" => "/index.php?url=$1&$3",
)
What I need is for the 1st set of rewrite rules above applied to everything except the other directories in the #Excluded rule above (as well as /subdirectory) then the 2nd set of rules applied to only /subdirectory
I got the first set of rules for WordPress from a blog somewhere online any may well be not exactly what I need (in regards to matching "mywebsite.com" and could probably be simplified).
I've Googled myself out trying multiple variations (mostly just stabbing in the dark guided by random forum posts that are slightly related), but I just can't wrap my head round it.
So how would I go about having the 2nd set of rules applied to the subdirectory while maintaining the Wordpress rules for the root?
Note: I have no access to subdomains (that would be too easy).