Create a file with the name in the root folder .htaccess
and add this:
RewriteEngine On
RewriteRule ^([a-z0-9_]+)$ painel/view/$1.php [L]
If the files have uppercase and minute letters you can adjust it like this:
RewriteEngine On
RewriteRule ^([a-z0-9_]+)$ painel/view/$1.php [NC,L]
The ([a-z0-9_]+)
search only files with name that has letters, numbers and underline
The ^
and the $
do check from start to finish to make the "match"
The $1
take whatever is inside the stop and add to get the request "true"
The NC
makes the regex to be case-insenstive (at first there is no)
The L
makes ignore the next rules (RewriteRule
) avoiding conflicts
If it occurs error 500 may be two possibilities:
- You have added something else within your . htaccess, which is conflicting
- Or you haven’t enabled mod_rewrite in apache (which is a rare medium nowadays to occur)