Across the entire domain, we'd like the URLs to hide file extensions and remove trailing slashes, independent of the domain name itself (as in, works on any domain).
Sample of our directory structure
We're not using index.* files except for the homepage.
Some examples of how these files might be requested, and how they should look in the browser:
mydomain.com(literally just the bare domain name).
As you can see, there are several ways to access each webpage, but no matter which of the 2 or 3 ways you use to get there, it only shows the one preferred URL in the browser.
How is this done with .htaccess using mod_rewrite?
I've banged my head against the wall trying to figure this out, but in general, the rewrite flow would seem to be something like this:
- External 301 redirect (
- Internally append .php (
I've been Googling this all day, read thousands of lines of documentation and config texts, and have tried several dozen times... I think more brains on this would help a lot.
We found an answer our question (see below).