这是我的.htaccess代码
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On**RewriteBase /RewriteRule ^test/?$ test.php [L,NC]
但它并没有将我重定向到“test”。在.htacces中有任何错误,或者我必须做一些Apache配置更改。 感谢
答案 0 :(得分:1)
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
## hide .php extension
# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L,NC]
## To internally redirect /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [L]
答案 1 :(得分:0)
试试这个
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php