.htaccess 使用htaccess重写url时出错

.htaccess 使用htaccess重写url时出错,.htaccess,url-rewriting,.htaccess,Url Rewriting,嗨,我想重写http://immortalgoddess.com/index.php?/welcome/index 链接到 http://immortalgoddess.com/index.php?mainpage.html.I 在我的项目中使用codignator框架。 我试过这个代码,但不管用 RewriteEngine on RewriteRule ^http://immortalgoddess.com/index.php?mainpage.html$ http://imm

嗨,我想重写http://immortalgoddess.com/index.php?/welcome/index 链接到 http://immortalgoddess.com/index.php?mainpage.html.I 在我的项目中使用codignator框架。 我试过这个代码,但不管用

 RewriteEngine  on

    RewriteRule ^http://immortalgoddess.com/index.php?mainpage.html$ http://immortalgoddess.com/index.php?/welcome/index
如果有人知道,请回复

RewriteCond %{QUERY_STRING} /welcome/index
RewriteRule /index.php$ /index.php?mainpage.html [L]
如果不起作用,请尝试删除斜杠:

RewriteCond %{QUERY_STRING} /welcome/index
RewriteRule index.php$ /index.php?mainpage.html [L]
告诉我它是否有效

现在有两个提示: 请尝试使用RewriteLog指令:它可以帮助您跟踪此类问题:

# Trace:
# (!) file gets big quickly, remove in prod environments:
RewriteLog "/web/logs/mywebsite.rewrite.log"
RewriteLogLevel 9
RewriteEngine On
我最喜欢的检查regexp的工具:


别忘了选择eregPOSIX而不是pregPCRE

我相信这个问题更适合StackOverflow的姐妹站点ServerFault。它实际上与编程无关。重写问题也与主题有关。