I have a .htaccess file that redirect any extension to a non-extension url and displays the requestedfilename + .php. It works great with the (.*) part of the conditions.
When I type domain.com/file.html or domain.com/file.xml it displays the file.php and the url looks like domain.com/file.
I just would like to know how to exculde extensions like .js and .css from the expression. I don't want to redirect them to any other php file.
I tried things like: (.*!.(js|css)) instead of (.*) but I can't find a working solution...
The current code is this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#
# to display the name.php file for any requested extension (.*)
#
RewriteRule ^(.*)\.(.*) $1\.php
#
# to hide all type of extensions (.*) of urls
#
RewriteCond %{THE_REQUEST} ^[A-Z]+\s.+\.(.*)\sHTTP/.+
RewriteRule ^(.+)\.php $1 [R=301,L]
#
# no extension url to php
#
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) $1\.php [L]
</IfModule>