简体   繁体   中英

How to add / to the end of a URL using IIS7 Rewrite rules

I need to add a trailing / to a url if it doesn't have one or isn't a file. So

http://www.ddd.com/dasdas

would become

http://www.ddd.com/dasdas/

But I don't what to just add slash the URl as this will end up with filename like this style.css/

So I need a piece of Regex that I can put into the IIS 7 rewrite engeine to append when needed

I am not really familiar with ISS, but if it supports standard regular expressions then I would suggest something like this:

Search pattern: ^.*?\\/[\\w\\d-_]+$
Replace pattern: $0\\/

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM