I am using mod_rewrite in .htaccess. I can't figure out how to get the following done.
- All css pages should go to
/minify/?f=/styles.css - All js pages should go to
/minify/?f=/js.js - All
.txt,.gif,.jpg,.pngfiles should open as they are - All other pages (eg:
/page,/dir/page,/dir1/dir2/page) should go to/page.php - All other files in directories should open as it is (eg:
/admin/login.php)
Edit:
This is the code that I came up with. It's not elegant, and it fails sometimes. For eg: I can't get /admin/login.php to work. When I open that URL, it's going to page.php.
RewriteEngine on
RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.gif|\.txt)$
RewriteRule .* page.php
RewriteRule ^.*?\.css$ /min/?f=/styles.css [L]
RewriteRule ^.*?\.js$ /min/?f=/js.js [L]