#RewriteEngine On
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_FILENAME}\.php -f
#RewriteRule ^(.*)$ $1.php
RewriteEngine On
RewriteBase /
# Use the following rule if you want to make the page like a directory
RewriteRule ^user/(!(profile.php))$ user/$1/ [R=301,L]
# The following rule does the rewrite.
RewriteRule ^user/(.+)/$ profile.php?id=$1
# The following rewrite the other way round:
RewriteCond %{REQUEST_URI} ^/profile.php
RewriteCond %{THE_REQUEST} ^(GET|POST|HEAD|TRACE)\ /profile.php
RewriteCond %{QUERY_STRING} id=([^&]+)
RewriteRule ^profile.php$ user/%1?
<files .htaccess>
order allow,deny
deny from all
</files>
RewriteCond %{HTTP_HOST} ^www\.mysite\.com$
RewriteRule ^(.*)$ "http\:\/\/mysite\.com\/$1" [R=301,L]
当我访问此 URL 时:http: //mysite.com/user/john/ - 这完全可以正常工作!但是当我在最后没有斜杠的情况下访问 URL 时,如下所示:http://mysite.com/user/john浏览器告诉我这个错误:
我应该在这里做什么?您的帮助将不胜感激和奖励!
谢谢!:-)