Custom URL Rewriting in Classic ASP

跟風遠走 提交于 2019-12-01 14:23:19

问题


I have been trying to rewrite the URL in classic ASP. I am currently using IIS 7.5. I tried to use the URL Rewrite plugin which converts the following link:

http://blog.johnavis.com/blog/default.asp?id=19

into something like this:

blog.johnavis.com/19/

blog.johnavis.com/id/19/

blog.johnavis.com/blog/default/19

blog.johnavis.com/blog/default/id/19

I want to convert into something like this: http://blog.johnavis.com/blog/myblog/

Can that be achieved? Any help would be appreciated.


回答1:


Basically all the rewrite module does is to edit your web.config file. You're probably better off editing the file yourself. You'll find that it has created a section called rewrite, add the following rule

        <rewrite>
            <rules>
                <rule name="My Blog">
                    <match url="blog/myblog/" />
                    <action type="Rewrite" url="blog/default.asp?id=19" />
                </rule>

            </rules>
        </rewrite>



回答2:


You can achieve this by creating URL rewrite rule in IIS Manager by defining a pattern. Use the following links to learn about that.

http://www.iis.net/learn/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module

http://www.iis.net/learn/extensions/url-rewrite-module/url-rewrite-module-video-walkthrough

Hope this helps...



来源:https://stackoverflow.com/questions/23009923/custom-url-rewriting-in-classic-asp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!