First of, am not sure i understand correctly your question, but i give it a try anyway.
Currently you have:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)$ /index.php?page=$1 [QSA,L]
What you'd need in addition is:
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{HTTP_REFERER} !^http://your-domain\.tld/.*$ [NC]
RewriteRule XXXXXX/(.*)$ - [F,NC,L]
.htaccess RewriteRule
's are checked in the order they occur, so you might want to do something like this, although I stand corrected because haven't had a chance to check if it'd work:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^([^/]+)$ /index.php?page=$1 [QSA]
RewriteCond %{HTTP_REFERER} !^http://your-domain\.tld/.*$ [NC]
RewriteRule XXXXXX/(.*)$ - [F,NC,L]
That is, first check if it's an argumented file named index.php which should be rewritten, if not (no L
flag), go on for the next rule first grabbing a new condition, then if the rule validates, restrict access (throw HTTP 403).
Does this make sense?
Anyway, please experiment with the above .htaccess example because as I said, I couldn't test it.