What I want is a Wordpress type of URL rewrite.
What I have now is:
.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ rewrite.php?data=$1 [L,QSA]
This almost works rewriting everything except existing files (css,js etc files are not rewritten as expected).
The problems I have with this are:
.css
,.js
, Image and PHP files are also accessible by entering their file name. eg.:domain.com/style.css
will be accessible by anyone.I want some existing files(only php right now) to be redirected anyway. eg.: domain.com/movies.php should redirect to rewrite.php(include 404.php) and domain.com/movies or domain.com/movies/ would include movies.php page.
Ideally I would also be able to change user entered URL from domain.com/movies
to domain.com/movies/
for consistency more than anything else.
I want to keep .htaccess
to a bare minimum. Does wordpress rewrite everything including .css
files?
What I want:
- Some php files to redirect others not. eg: includes/func.inc.php should not be accessible to the users, while movies.php should be accessible but ONLY from this url domain.com/movies/
(not essential)
Change url to canonical url eg: domain.com/movies to
domain.com/movies/ (some resources on how to achieve this would be
nice). Note: domain.com/movies url should still work but appear with a slash at the end either via rewrite or maybe by just adding a slash with javasript (faster?)Make .css/.js files inaccessible by the user. eg: domain.com/style.css should redirect the user to a 404 page