I'm new to friendly urls so maybe something basic is missing.
My htaccess contains:
RewriteRule ^([a-zA-Z0-9-/+]+)/?$ /index.php?surf=$1
inside index.php I handle the request like this:
switch ($_GET['surf']) {
case "whatever":
...
So links are like domain.com/home and I include a home.php using index.php for the purpose
Everything works for standard cases, but if someone inputs the name of a directory as parameter like: domain.com/css
The page gets messed up. The adress bar shows: http://domain.com/css/?surf=css and the content is like the default case in index.php (home), but without styles and such.
I guess it is trying to visit http://domain.com/css/index.php?surf=css after the htaccess and index stuff.
How can I fix this?
*Note that I have some index.php in some other directories that I would like to have access.
add these lines:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9-/+]+)/?$ /index.php?surf=$1
This prevents redirecting real files and folders.