我希望http://www.mycom/api/*
个mycom/api/index.php
文件路径
RewriteEngine On
#1
RewriteRule ^api/([a-zA-Z]+) /mycom/api/index.php?mode=$1 [QSA,L]
导致内部服务器错误
#2
RewriteRule ^/api/([a-zA-Z]+) /mycom/api/index.php?mode=$1 [QSA,L]
# 3
RewriteRule ^mycom/api/([a-zA-Z]+) /mycom/api/index.php?mode=$1 [QSA,L]
2和3不起作用
答案 0 :(得分:2)
index.php的真实网址是什么? http://www.mycom/api/index.php或http://www.mycom/mycom/api/index.php?
在第一种情况下试试这个:
RewriteRule ^api(/.*)? /api/index.php?mode=$1 [QSA,L]
如果是第二个
RewriteRule ^api(/.*)? /mycom/api/index.php?mode=$1 [QSA,L]
BTW,您是否需要原始查询字符串和模式参数?