RewriteEngine On

# Rewrite rule for removing .php extension
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^/]+)?$ $1.php [L]

# Rewrite rule for redirecting to mobile/home if file or directory not found
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ /mobile/404 [L,R=301]