0
我一直在尝试使用此代码从我的网址中删除.php结尾,但它不起作用。这是我的.htaccess文件:从URL中删除.php扩展名(.htaccess)
# Apache Rewrite Rules
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase/
# Add trailing slash to url
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/|#(.*))$
RewriteRule ^(.*)$ $1/ [R=301,L]
# Remove .php-extension from url
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^([^\.]+)/$ $1.php
# End of Apache Rewrite Rules
</IfModule>
我把那个文件放到我的public_html文件夹中。由于某种原因,它仍然显示example.com/index.php
而不是example.com/index
。任何线索为什么?