I'm looking for help with my rewrite rule in .htaccess. What I need:
When going to www.mysite.com/page.php check to see if www.mysite.com/pages/page.php exists, if it does redirect to www.mysite.com/#page.php, if it doesn't redirect to www.mysite.com/#404.php
Same should occur for pages nested in directories. So when going to www.mysite.com/directory/page.php check to see if www.mysite.com/pages/directory/page.php exists, if it does - redirect to www.mysite.com/#directory/page.php otherwise redirect to www.mysite.com/#404.php
What I have right now is:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php#$1 [QSA,L]
Which doesn't work at all. Everything seems to get redirected to www.mysite.com/index.php without any hash values being passed at all. And I'm also not sure how to include the if statement in there to check to see if file exists inside www.mysite.com/pages/
Your help would be greatly appreciated. Thank you.