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.
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>
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...
Related
I have created an application that utilizes RAD Studio's EMS Server functionality. The development has been completed and tested in a production environment. The EMS Server documentation shows that in order to make an API call the emsserver.dll needs to be included in the URL.
https://{hostname}/emsserver/emserver.dll/API/Login?token={TokenValue}
Most APIs I have encountered do not have the dll embedded into the URL.
https://{hostname}/API/Login?token={TokenValue}
This is not a big deal as the API call works fine as is. I was just wondering if there is property or setting I can use in RAD Server or IIS in order to default the emsserver/emsserver.dll portion of the URL.
Do you mean you want to redirect or rewrite the url from https://{hostname}/API/Login?token={TokenValue} to https://{hostname}/emsserver/emserver.dll/API/Login?token={TokenValue} in IIS?
If this is your reuqimrent, I suggest you could try to use url rewrite extension to achieve your reuqirement.
You could install it from this url and add below url rewrite rule into your web.config file.
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect to dll">
<match url="API/Login" />
<action type="Rewrite" url="https://{hostname}/emsserver/emserver.dll/API/Login" />
</rule>
</rules>
</rewrite>
</system.webServer>
I am using the IIS Rewrite module with my web.config, and would like to rewrite certain requests by replacing a word in the URL.
Example: http://domain.com/windows to be http://domain.com/WINDOWSSoftware
I'm aware that a URL with query string parameters can be rewritten using for example below rule
<rules>
<rule name="Rewrite to article.aspx">
<match url="^article/([0-9]+)/([_0-9a-z-]+)" />
<action type="Rewrite" url="article.aspx?id={R:1}&title={R:2}" />
</rule>
</rules>
Instead of /article?id=243&title=some-title we can have /article/234/some-title
I'm wondering if this can be achieved using URL Rewrite, or can it be done by developing a custom provider.
This can definitely done with url rewrite module with bit of regex pattern matching.
http://domain.com/windows/sdfsdf
so if you just match {R:1} or {C:1} depending on how you setup
The final redirect can look like
{HTTP-HOST}/WindowsSoftware/{R:2}
When I put my web.config into any folder/main directory it seems to be throwing the HTTP error code: 500--unfortuenly I don't have access to the logs so I can't see why, so surely it's down to my web.config - I've never used IIS before but I'm trying to re-route all requests to a file called 'api.php', here's my web.config file.
<rewrite>
<rules>
<rule name="rule 1Q">
<match url="^/.*" />
<action type="Rewrite" url="/api.php" />
</rule>
</rules>
</rewrite>
Apache equivalent:
RewriteEngine on
RewriteRule ^/.* /api.php
Any help is greatly appreciated.
This is not an exact answer because I am not sure of your server variables but here is something that might be useful to you. Here. This walks through the IIS set up for version 7 and it has some basic concepts. There is rewrite module/tool that could help but I haven't used it. And another document here...Shows the GUI interface like the first link and is in 7.5.
Again not specific solutions but hopeful you have some server gurus there that can help you at least get the IIS settings right (or at least not sound dumb if you have to communicate something specific to them) if this is a first time IIS Isapi venture for you.
I did a bit of search but can't find a complete answer to my question:
I wonder if it's possible to set my IIS 7.5 to map one "custom" extension to another "physical" extension.
Eg.
I have Default.aspx, I'd like my server to serve this file to a request of Default.foo.
The mapping questions/answers I found are all about having Default.foo files, and mapping them to the proper handler; that's not my case, I just like to have a sort of masking of the real physical file extension.
Is it possible?
TY
The mapping should be setup between default.foo and default.aspx, mapping extensions cannot achieve this goal. You may use URL Rewrite module to create a rule to rewrite default.foo to default.aspx.
A simple example is as below,
<rewrite>
<rules>
<rule name="foo" stopProcessing="true">
<match url="(.*)\.foo" />
<action type="Rewrite" url="{R:1}.aspx" />
</rule>
</rules>
</rewrite>
We are replacing an existing Apache hosted web site with an ASPX IIS 7.5 hosted web site.
At present, Google displays several sub page results (relative to the main site) where the sub page (Apache) link looks something like this...
http://mysite.co.uk/mypage.html;jsessionid=D4F2C4D93229A451BCA886061501C777
I want this link to be (301) redirected by IIS to something like this...
http://mysite.co.uk/anotherpage.aspx
I can create an 301 HTTP redirect in IIS to redirect "mypage.html" to "anotherpage.aspx" but that doesn't work when the incoming request for "mypage.html" also includes the ";jsession=...".
I've looked at redirect wildcards but I can't seem to get the right result.
Any advice would be much appreciated!
I solved this problem with IIS URL Rewrite. The following sample rule would solve the problem I described above...
<rewrite>
<rules>
<rule name="mypage">
<match url="^mypage.html" />
<action type="Rewrite" url="anotherpage.aspx" appendQueryString="false" />
</rule>
</rules>
</rewrite>