0

这是我的 .htaccess 代码

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On**RewriteBase /RewriteRule ^test/?$ test.php [L,NC]

但它并没有将我重定向到“测试”。.htacces 中是否有任何错误,或者我必须进行一些 Apache 配置更改。谢谢

4

2 回答 2

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]
于 2013-06-20T07:34:20.033 回答
0

尝试这个

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
于 2013-06-20T07:22:03.687 回答