Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /online_shoping/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ $1.php [L]
这是我的代码,用于在使用.php后删除.php扩展名但是?和=仍然出现,使用此代码后我的登录脚本也失败了所以请指导我哪里错了?
提前致谢
答案 0 :(得分:0)
使用它对我有用
RewriteCond %{REQUEST_FILENAME}.php -f
# IF the request filename with .php extension is a file which exists
RewriteCond %{REQUEST_URI} !/$
# AND the request is not for a directory
RewriteRule (.*) $1\.php [L]
# redirect to the php script with the requested filename