I have a domain let's call it newsite.com which is parked to maindomain.com. I use mod-rewrite to direct all requests for newsite.com to a subdirectory on maindomain.com. On newsite.com I have CodeIgniter installed. Which means the urls look like this:
newsite.com/products/shoes/
The above works just fine.
However, if I set up a controller for a page like this:
newsite.com/about/ or newsite.com/about/faqs/
I get a 404 which I believe is being caused because it is looking for the page maindomain.com/about.php which does exist, but does NOT exist on newsite.com.
My question is.... how do I PREVENT urls like newsite.com/about/ from pointing to newsite.com/about.php ? This is the opposite of what many people try to do (they tend to want to allow the file extension to be missing).
I'm wondering if it is and apache or PHP setting that causes it to look for the file first if it exists and the directory does not? Or do I need to add more mod-rewrite rules?
Thanks very much!
Edit - here is my .htaccess file currently. It resides at the web root of the maindomain.com shared hosting account.
# Redirect various urls to subfolders of the format: /site-thename/
RewriteEngine On
# Remove the www for NewSite.
RewriteCond %{HTTP_HOST} ^www.newsite.com$ [NC]
RewriteRule ^(.*)$ http://newsite.com/$1 [R=301,L]
# Handle pages and directories that should not go through CodeIgniter.
RewriteCond %{HTTP_HOST} ^(www\.)?newsite\.com
RewriteCond %{REQUEST_URI} !^/site-newsite/
RewriteCond %{REQUEST_URI} ^/demo/ [OR]
RewriteCond %{REQUEST_URI} ^/robots\.txt [OR]
RewriteCond %{REQUEST_URI} ^/emailform\.php [OR]
RewriteCond %{REQUEST_URI} ^/assets/ [OR]
RewriteCond %{REQUEST_URI} ^/index\.php
Rewriterule ^(.*)$ /site-newsite/$1 [L]
# Handle CodeIgniter URLs.
RewriteCond %{HTTP_HOST} ^(www\.)?newsite\.com
RewriteCond %{REQUEST_URI} !^/site-newsite/
Rewriterule ^(.*)$ /site-newsite/index.php?/$1 [L]