本文介绍了IIS 7.0 URL重写模块 - 不显示根URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在IIS 7.0中设置一个PHP网站,并使用此模块启用URL重写()

I'm trying to setup a PHP website in IIS 7.0 with URL rewriting enabled using this module (http://www.iis.net/downloads/default.aspx?tabid=34&g=6&i=1691)

我已经完成了网站内页的整个运行,但我的根网址/不再有效。

I've got the whole thing running fine for inner pages of the site, but my root URL "/" doesn't work any more.

我希望我的网址结构为www.test.com/test-page.html,并将其重写为www.test.com/index.php?page=test-page

I want the structure of my URLs to be www.test.com/test-page.html and this is rewritten to www.test.com/index.php?page=test-page

我指定的规则如下:

要匹配的正则表达式:^([^ /。] +)/ ?.html
重写为:/index.php?page = {R:1}

Regular expression to match : ^([^/.]+)/?.htmlRewrite to: /index.php?page={R:1}

因为我说它适用于所有内页因此www .test.com / test-page.html没有问题,只是主页,www.test.com不起作用。

as I said it works fine for all the inner pages so www.test.com/test-page.html would load no problem, it is just the homepage, www.test.com that doesn't work.

任何帮助都会非常感谢,我假设我需要添加一些额外条件?

Any help would be much appreciated, I'm assuming that I need to add some sort of extra condition?

推荐答案

试试^(?:( [^ /。] +)。html)?$

try ^(?:([^/.]+).html)?$

这将使整个检查: 1个或多个字符不是/否。然后是.html 可选。

this will make the entire check for: 1 or many characters not / or not . followed by .html optional.

这篇关于IIS 7.0 URL重写模块 - 不显示根URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 04:58