First thankyou anyone, Engilsh is not my native language But this problem is very difficult for me
I need http://xxxx.show.bis.tw/event_register/index.php?id=image01
to http://xxxx.show.bis.tw/event_register/image01
and if the users enter http://xxxx.show.bis.tw/event_register/image01
on address bar the website is can work
I think the rules is users can input those http://xxxx.show.bis.tw/event_register/image01
http://xxxx.show.bis.tw/event_register/index.php?id=image01
1. http://xxxx.show.bis.tw/event_register/index.php?id=image01
Redirect like this http://xxxx.show.bis.tw/event_register/image01
and go to rule2 Rewrite <action type="Rewrite" url="index.php?id={C:1}" />
2. http://xxxx.show.bis.tw/event_register/image01
just only Rewrite <action type="Rewrite" url="index.php?id={C:1}" />
my code is if file and directory do Redirect or Rewrite website will broken (css/js/image)
I try to rule>1 and rule>2 write in one rule but it not work I don't know how to fix it
<rewrite>
<rules>
// 1
<rule name="025" stopProcessing="true">
<match url=".*" />
<conditions> // file and directory not Redirect|Rewrite
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Redirect" url="{C:0}" appendQueryString="false" />
</rule>
// 2
<rule name="026">
<match url="index\.php(.*)" />
<conditions>
<add input="{QUERY_STRING}" pattern="id=(.*)" />
</conditions>
<action type="Redirect" url="{C:1}" appendQueryString="false" />
</rule>
// 3
<rule name="027" enabled="true" stopProcessing="true">
<match url=".*" ignoreCase="true" />
<conditions>
<add input="{URL}" pattern="/index.php?id=" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?id={R:1}" />
</rule>
</rules>
</rewrite>
thankyou anyone very thank I almost tow days can't not sleep just fix this
Have you tried rewritemaps instead of rules in your web.config file?
<configuration> <system.webServer> <rewrite> <rewriteMaps> <rewriteMap name="rewrites"> <add key="/event_register/image01" value="/event_register/index.php?id=image01" /> </rewriteMap> </rewriteMaps> </rewrite> </system.webServer> </configuration>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.