Remove Apache "/" at the end of the URL?

Hey, I have a file with 'notes.php' and a folder 'notes' in the web folder, I would like apache to prefer the php file.

 RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^\.]+)$ $1.php [NC,L]

Currently I use this to remove .php at the end

(1 votes)
Loading...

Similar Posts

Subscribe
Notify of
6 Answers
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Babelfish
1 year ago

This is called “Failure by Design”. If /notes and /notes/ different content ads, you should reconsider your URL Schema.

Babelfish
1 year ago
Reply to  20Jonas05

It is not about whether something works, but about whether it is sensible to give /notes and /notes/ different content is not sensible.

But if it’s not from you, you probably can’t change it either. Since I’ve been working with nginx for a long time, I’m not the expert with Apache. Note, however, that a .htaccess can be found in each directory, which can overwrite information from “top”. So if there is a .htaccess in /notes/ for example, the /.htaccess can overwrite. Is at least a not so rare problem if changes do not intervene.

iQa1x
1 year ago

Try to see if it’s possible if you get the line

RewriteCond %{REQUEST_FILENAME} !-d

environment.

FaTech
1 year ago

Why don’t you call the notes.php index.php and put it in the Notes folder? Has exactly the effect and you save the htaccess