If a subdomain isn't in my URL (or its "www") I'm trying to force an underscore as the subdomain. I went round in circles yesterday trying to understand this, here's what I have so far:-
Rule #1. Remove file extensions - works, until I add rule 2 to .htaccess.
Options -Multiviews
RewriteBase /
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) $1\.php [L]
Rule #2 If there is no subdomain present automatically use an _ eg: _.mysite.com
RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
RewriteRule ^(.*)$ http://_.%{HTTP_HOST}/$1 [L,R=301]
Rule 2 works, but it's adding the .php back onto the end of the filename?
I've tried moving the "_" rule above the extension rule but it doesnt make a difference.
Would be greatful for any help =)