edit2:
SOLVED by myself, my RewriteBase directive was confusing matters, BUT I would still be interested to know how to refer to the directory in which the .htaccess file is. Hi guys and gals,
apologies in advance for what is probably a silly question.
I am developing several sites on localhost, though they will each be deployed at their own domains.
Each project is in a folder named as per the domain at it will eventually reside.
Assuming
//localhost/ is configured with DocumentRoot as
C:\www\ (I'm mentioning that it's on Windows just in case it matters, but I doubt it.) C:\www\.htaccess
C:\www\index.php
C:\www\example.com\.htaccess
C:\www\example.com\index.php
C:\www\example2.com\.htaccess
C:\www\example2.com\index.php
where C:\www\index.php simply lists the subfolders as shortcuts for me.
C:\www\.htaccess contains simply
Options -Indexes
and C:\www\example.com\.htaccess contains
RewriteEngine On
RewriteBase /
RewriteRule ^([\w\-_]+)/?$ ./index.php?page=$1 [NC]
I assumed that I would be able to visit
//localhost/example.com/contact and this would be rewritten to
//localhost/example.com/index.php?page=contact,
but it seems to be missing the subfolder and is instead going to
//localhost/index.php?page=contact I'm surprised that
./index.php in the .htaccess doesn't either error or work as I expected.
Any help/suggestions/advice will be massively appreciated.
----
edit: I added
RewriteEngine On
RewriteBase /
above. I realise now that the RewriteBase directive may in fact be part of the problem.