English 中文(简体)
旋转参数
原标题:passing parameters to rewrited urls

我的项目有关于不同网站的数据,因此,我用“htaccess”来改写陶器,这样,当有人在我的网站上贴上载有一门狗的名字时,它就显示该网站。 php page. 我的守则是:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9\_-]+(.)[a-zA-Z0-9\_.-]+)/?$ site.php?url=$1
RewriteRule contact$ contact.php

这把现场名称作为参数发送到现场。 现在,我想再通过一个参数,就像它能够被普遍通过一样。 我希望该网站获得实时更新数据,即希望通过<代码>?update=true。 从而更新互联网数据,然后从数据库中提取数据。 但穿过像这样的参数

http://www.mysite.com/anysite.com?update=true

难道没有工作,我怎么能把更多的参数传给我现有的再写吗?

最佳回答

<[QSA] states (query string append) will append any received query string onto the re written URL. 我还增加了<代码>>旗帜,作为防止与你的第一项规则相匹配的最佳做法,如果添加一条,在你链条后面添加一条规则。

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9\_-]+(.)[a-zA-Z0-9\_.-]+)/?$ site.php?url=$1 [QSA,L]
RewriteRule contact$ contact.php [QSA,L]

然而,如果我误解了这个问题,那么你不需要寄送<条码>update=true,而只是想根据所有要求迫使它,只是把它添加到死板上:

RewriteRule ^([a-zA-Z0-9\_-]+(.)[a-zA-Z0-9\_.-]+)/?$ site.php?update=true&url=$1 [QSA,L]
问题回答

暂无回答




相关问题
URL rewrite in IIS6 - Third party tools

I have collected the following api/sdk/whatever which provide modules for doing url rewriting in IIS 5/6/7. Some are free-open source and some require $. I haven t tried any of them. I would like to ...

Rewrite spring-security redirect URLs

I m trying to get Tuckey UrlRewriteFilter to tidy up URLs for my webapp. One problem I ve got is that when spring-security notices that an anonymous user is trying to access a protected resource it ...

ASP.NET Friendly URLs

In my research, I found 2 ways to do them. Both required modifications to the Application_BeginRequest procedure in the Global.Asax, where you would run your code to do the actual URL mapping (mine ...

Could I get by HttpModule the URL that contains * before?

My web-site is working under ASP.NET 3.5, IIS7, Integrated pipiline mode. My HttpModule is getting request to all resources, including URLs like this: http://my-site.com/address And I would support *...

Domains & Foreward Slash

This is rather difficult to explain so please bear with me. We will be hosting 4 websites on our server and the plan is to have each site sit under its own domain: site-a.com site-b.com sub1.site-b....

URL Mod-Rewrite

I currently have a working URL: http://example.com/security-services.php?service=fixed-camera-surveillance and then I have PHP say, $_REQUEST[ service ] to do some stuff... But I d like to ...

热门标签