【问题标题】:URL Rewrite IIS servername doubledURL 重写 IIS 服务器名加倍
【发布时间】:2017-03-07 12:27:37
【问题描述】:

我已经从 .htaccess 文件中导入了重写规则:

 RewriteCond %{REQUEST_URI} ^system.*
 RewriteRule ^(.*)$ /index.php?/$1 [L]

 RewriteCond %{REQUEST_URI} ^application.*
 RewriteRule ^(.*)$ /index.php?/$1 [L]

 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule ^(.*)$ appname/index.php?/$1 [L]

但是,当我请求 http://appname/page/param 时,它会被重写为 http://appname/appname/page/param。 在 IIS 管理器重写规则中,它显示“在 /appname 之后输入 URL 路径”。在我看来它应该是“/之后的输入URL路径”,但我不知道如何更改。有人可以帮忙吗?

【问题讨论】:

    标签: mod-rewrite iis url-rewriting iis-8.5


    【解决方案1】:

    你尝试过你的预感吗?你是对的。

    RewriteRule 的第二个参数是替换,应该是内部重写的真实路径。如果您的 index.php 位于 web 根目录中,并且那里没有 appname 目录,您可以从替换中删除 appname/。

    【讨论】:

    • 我检查了这个事实,发现我只需要切换到我的服务器树中的更高级别并添加重写规则。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-08
    • 1970-01-01
    • 1970-01-01
    • 2011-07-01
    • 2014-08-08
    • 1970-01-01
    相关资源
    最近更新 更多