I had minor problems with the rewrite rule, which after Google didn’t lead me to nowhere. I have a standard rewriting URL, for example:
RewriteRule ^services/(.*)/ /services/index.php?content=$1 [L]
The site uses the content value to request related content from the database, but simply makes the URL more beautiful; standard material. It works to a certain extent. If, for example, my URL us /services/testimonials/ rule works fine; the content loads and the page displays normally. What I saw with some URLs though (e.g. /services/training/ ) was an error:
Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0 Fatal error: Unknown: Failed opening required 'redirect:/services/index.php' (include_path='[removed]') in Unknown on line 0
After a lot of conversation and a header (with little success), I found that if I changed the URL to /services/training/ (note the capital T), it worked. This quickly led me to think of a conflict in the URL with something (which I probably should have thought about, above all, in retrospect). After checking which URLs worked and which didn’t, I connected the dots and found that the URLs that were broken have files with the same name in the subdirectories as the URLs. This sentence is confusing. Basically, I can’t use URL /services/training/ , since there is a file /services/training.php that causes an error return.
There is an explicit fix that consists in renaming files that conflict with URLs, but is there a way in the rewrite rule where I can make it ignore any files that it can find with the same name?
source share