我想从我的网站的网址中删除文件的任何扩展名。
例如:www.example.ml/dash/logins/sign.php到:www.example / dash / logins / sign /
我做了很多谷歌搜索,但是没有一个答案对我有用。我认为它没有用,因为在logins文件夹中我没有一个文件。
[还有许多其他文件,例如index.php,sign.php等。我是否必须将每个文件保存在单独的文件夹中,否则sing.php可以更改为sign /。另外,会发生什么:
sign.php?usercode=1
它将转换为
sign/usercode=1
?
我已经在.htaccess中提供了一些代码,因此请在参考此代码后给出您的答案。
php_value display_errors Off
php_flag magic_quotes 1
php_flag magic_quotes_gpc 1
php_value mbstring.http_input auto
php_value date.timezone America/New_York
Options -Indexes
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.example.ml$ [NC]
RewriteRule ^(.*)$ https://www.example.ml/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ([^\.]+)$ $1.php [NC,L]
# Turn on the rewrite engine
RewriteEngine on
# If the request doesn't end in .php (case insensitive) continue processing rules
RewriteCond %{REQUEST_URI} !\.php$ [NC]
# If the request doesn't end in a slash continue processing the rules
RewriteCond %{REQUEST_URI} [^/]$
# Rewrite the request with a .php extension. L means this is the 'Last' rule
RewriteRule ^(.*)$ $1.php [L]
该示例取自Tim Bielwa,