This is probably a real easy question. I'm just having a simple clean URL kind of setup, so www.website.com/articles/music
would rewrite it to index.php?cat=articles&subcat=music
or whatever, that's just an example. But of course if it's a file request (e.g. website.com/images/icons/music.png
) it'd check for a valid file first. That was easy enough, there's plenty of tutorials online for that using .htaccess and rewrite rules which gave me something like this
RewriteEngine On
# Check for existing files first
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Set base
RewriteBase /
# Rewrite rules not shown but would be below
The last condition I want to make is it also checks if the given URL folderpath exists and there is an index.php or index.html in it. E.g. continuing the first example, check to make sure there isn't a website.com/articles/music/index.html
or index.php
either, and if so, redirect to that instead of the rewrite rules.
Like I said probably simple enough, but I'm not good with htaccess stuff since I rarely use it and it was an irregular question that I couldn't find answers for. Not that they probably don't exist but the wording I tried to use didn't pop up anything. Thanks.