I am trying to shorten the URL, but unfortunately I can not find anything that will help.
I share my code in folders. The index is positioned as root in the same way as my .htaccess. Folders are called as file extensions, so php, js, css [...]
I have a link like:
localhost/php/getBets.php
and want him to be
localhost/getBets/
I already have a part that shortens the .php extension at the end, so here are my full .htacces
Options +FollowSymLinks -MultiViews RewriteEngine On RewriteBase / # Hide Index IndexIgnore * # Forbid accessing certain sites RedirectMatch 403 ^/.gitignore$ RedirectMatch 403 ^/.htaccess$ RewriteRule ^(?!index)(?!.*getBets).*\.(php|rb|py|txt|md|sql|inc)$ - [F,L,NC] # Hide .php file ending in URL 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]
Can someone tell me how I could achieve this? :) Thank you very much!
source share