i'm weak in regular expressions, i need to redirect any FileName.htm or FileName.html page request to ./#FileName, only if the request is incoming from an outside link. These files will all reside in the root directory.
this is what i have so far. it gives me errors : (
RewriteCond %{REQUEST_FILENAME} !index.html$|!index.htm$ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !example\.com [NC]
RewriteRule ^([a-zA-Z0-9\-_]+)\.html$ /#$1 [NE, R]
the first line makes sure only index files are not redirected. the second line doesn't redirect if the request is coming from an unknown referrer the third line excludes my domain from the redirection rule the fourth line redirects it to the hash link.
which doesn't seem to work.
and please if there is a more efficient way to write this, i would be grateful.
thank you!