我已经尝试了所有形式的StackOverflow,但没有任何效果。
此刻,我的网站就像www.domain.com/xxx
想要像www.domain.com/xxx.php的它
这是我的.htaccess文件
# <IfModule mod_negotiation.c>
# Options -MultiViews -Indexes
# </IfModule>
#
# RewriteEngine On
#
# # Handle Authorization Header
# RewriteCond %{HTTP:Authorization} .
# RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
#
# # Redirect Trailing Slashes If Not A Folder...
# RewriteCond %{REQUEST_FILENAME} !-d
# RewriteCond %{REQUEST_URI} (.+)/$
# RewriteRule ^ %1 [L,R=301]
#
# # Handle Front Controller...
# RewriteCond %{REQUEST_FILENAME} !-d
# RewriteCond %{REQUEST_FILENAME} !-f
# RewriteRule ^index.php [L]
#</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
尝试如下。
RewriteEngine On
RewriteCond %{REQUEST_URI} !\.[a-zA-Z0-9]{3,4}
RewriteCond %{REQUEST_URI} !/$
RewriteRule ^(.*)$ %{REQUEST_FILENAME}.php
并且我在公用文件夹中找到另一个.htaccess文件
这里:
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>