I just created the file .htaccess
so you do not have to name the label of the files to open them (delete the .php
of contacto.php
, for example).
It worked for me, but the problem is that now going to example.com/user, I try to open user.php
, when what I should do is use the index.php
inside (since user is a folder, inside contains index.php
)
I hope you have explained me well, here is the code of .htaccess
:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ $1.php
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]
Edited: I also just noticed that this code would only work with .php, and I need one that works with .html
Error: The requested URL /user.php was not found on this server.