Rewrite Rule To Map Locations To Static Files
Jul 22, 2010
What I want to do it rewrite urls for a bunch of static pages in a locations folder such that
/london
maps to the physical file if it exist in the locations folder eg.
/locations/london.aspx
Is this possible with url rewrite. I can't get the rule to work.
<rule name="Rewrite Locations">
<match url="^([_0-9a-z-]+)/*" />
<conditions>
<add input="/locations/{REQUEST_FILENAME}.aspx" matchType="IsFile" />
</conditions>
<action type="Rewrite" url="/locations/{R:1}.aspx" />
</rule>
View 1 Replies
Similar Messages:
Oct 4, 2010
I'm trying to redirect any non-www prefixed traffic to the www prefixed domain. I'm using Umbraco as the CMS and have added the following code into the urlrewritingnet config file:
<add name="nonWWW"
virtualUrl="^(?!www.)(.*)$"
rewriteUrlParameter="ExcludeFromClientQueryString"
destinationUrl="[URL]"
ignoreCase="true" />
I'm getting a "is not a valid virtual path" error
View 1 Replies
Feb 24, 2011
I am getting problem in URL rewrite rules. I am used UrlRewritingNet.UrlRewriter Dll for Url rewriting in asp.net website.I used rules name as "Advanced"& Other rule name as DefaultRule that is used for any user profile page(ie. any user's profile page).When I entered username as "AdvancedMachinesTools". That Rules as below:-
<urlrewritingnet rewriteOnlyVirtualUrls="true" contextItemsPrefix="QueryString" defaultPage="Login" xmlns="http://www.urlrewriting.net/schemas/config/2006/07">
<rewrites>
[code]...
View 2 Replies
Sep 27, 2010
I was wondering it is possible to turn off the canonical hostname URL Rewrite rule from the URL Rewrite 2.0 IIS 7.5 Module.
I'm locally developing on a IIS 7.5. The setting of this URL Rewrite rule is set in the web.config.
This is how I deploy: I'm using Webdeploy to publish my web application. The new web.config transforms, which was introduced with VS 2010, is no option for me, because it is bugged:
[URL] and will not be fixed until the release of VS2010 SP1. I'm also not using web deployment projects anymore, because Webdeploy does not seem working with web deployment projects. As a result, I manually switch on the rewrite rule in the web.config before deploying.
If I now want to locally debug something, I manually need to turn off the rule.
Is there a solution like this pseudo-code?
if(Properties.Settings.TurnOffCanonicalHostNameWithLocalHost)
{
URLRewriteModule["CanonicalHostName"].Enabled = false;
}
View 1 Replies
Mar 3, 2011
I have the following url which i want to write a helicon RewriteRule rule
it should check the pattern startat=/mypage.asp and then only executeOriginal urlhttp://www.test.com/welcome.asp?tartat=/mypage.asp&value1=23&value2=3434&value3=1&value4=someothervaluethe new url http://www.test.com/mynewpage.hcx?startat=/mypage.asp&value1=23&value2=3434&value3=1&value4=someothervalue
View 1 Replies
Jul 19, 2010
I have been struggling with this now for about two weeks, Within my site that functions as a directory, there are some simple Categories that appear to the user ashttp://www.mysite.com/subcat.aspx?catid=1 in the browser address bar. There are 15 of them in total.I would like to rewrite the URL of these Categories using RewriteMap in the following manner:
<rewriteMap name="CategoryNamesPrettyURL" defaultValue="">
View 4 Replies
Feb 24, 2011
I have a domain which is receiving quite a few hits per day and have been asked if I can serve the static content from a subdomain. As the site is quite extensive and already written, I was wondering if there is any way I can use URL rewriting to change:
www.example.com/image.gif
to
static.example.com/image.gif
I have a solution which works using 301 redirects but from what I understand, this is counter productive as 2 requests will have to be made per image. I don't really want to go through all the aspx pages and css to hard code the new url as it will cause problems further down the line - some parts of the site are still being developed and static content could change at any time. I tried using rewrite (as opposed to redirect) to change the url but it came out something like:
http://www.example.com/http://static.example.com/image.gif
How would you achieve this? I have full access to dns and the server (win 2008r2 / IIS 7.5) so can make any changes if url rewriting is not the answer.
View 1 Replies
Mar 16, 2010
UrlRewritingNet to my project now i can rewrite urls but i dont wanna rewrite images css files js files etc i only want to rewrite url as you can also guess for example how do i need to edit this code to achive this
<add name="Rewrite" virtualUrl="^~/PokePokedex/(.*)/(.*).aspx"
rewriteUrlParameter="ExcludeFromClientQueryString"
destinationUrl="~/Pokedex-Pokemon.aspx?PokemonId=$1&PokemonName=$2"
ignoreCase="true" />
View 4 Replies
Jul 21, 2010
After pre-compiled a ASP.NET web site, I got many files with the names like
App_Web_accountbalance.aspx.dfa151d5.dll
Do you know the rule for the random chars (in bold) above? Can we fix the random chars? The reason to fix it is that if we modify AccountBalance.aspx file later and re-compile the web site, can we just replace App_Web_accountbalance.aspx.dfa151d5.dll.
View 1 Replies
Nov 5, 2010
How to respect "Serve static content from a cookieless domain" page speed rule in IIS6?
View 3 Replies
May 17, 2012
I am using url rewriting rules in my web.config and have it working but today I added a rule in a folder but my primary rule keeps overriding.
Web.config
Code:
<rewriter>
<rewrite url="~/folder/*_a_(.+).aspx" to="~/folder/index.aspx?id=$1" />
<rewrite url="~/*_a_(.+).aspx" to="~/listing.aspx?id=$1"/>
</rewriter>
Usage:
www.domain.com/topic_a_1.aspx -> This would load listing.aspx?id=1 which is great.
www.domain.com/folder/newtopc_a_2.aspx -> This is also loading listing.aspx?id=2 but should be loading index.aspx?id=2
I believe I need to change the second rule from *_a_... to something like [^/]_a_.... but that doesn't work.
What I can do so the second rule doesn't override my sub folder rules?
View 2 Replies
Nov 29, 2010
I have a class that is creating an instance of StreamReader to an xml file on the local filesystem.
It may be possible that this same file is requested multiple times per-second.
I was wondering whether I need to manually add this file to the System.Web.Cache and read it from there, or whether Windows itself is clever enough to cache the item itself so that it 'knows' when ASP.NET requests this file the second/third etc time that it doesnt have to do a disk seek/read operation and pulls it from its own cache?
This article: http://dotnetperls.com/file-read-benchmarks seems to back this up, but this: article:
[URL](although not discussing from a performance perspective, and maybe for other reasons entirely) lists how to add a physical file to the cache.
View 1 Replies
Mar 15, 2011
I use a Masterpage (asp.net webforms) on my site and I woluld like to implement caching of some static files, like javascript, css etc.
I've tried adding the following to my page_load (in the masterpage) but when I use Fiddler the static files are still under "no-cache".
protected void Page_Load(object sender, EventArgs e)
{
// Set cache for 1 hour on all computers and servers.
// ... Proxies, browsers, and your server will cache it.
Response.Cache.SetCacheability(HttpCacheability.Public);
Response.Cache.SetMaxAge(new TimeSpan(1, 0, 0));
}
What am i doing wrong here?
View 1 Replies
Apr 1, 2011
I'm trying to configure IIS 7.5 to compress static htm and js files. Here is my web.config for the web site:
[code]....
Compression starts working when I set doDynamicCompression to true. But I can't use this option because it is disabled at my hosting.
View 2 Replies
Nov 2, 2010
How do I rewrite the url for static files? When adding something like
RouteTable.Routes.MapPageRoute("test", "style/style.css", "~/Static/Styles/Public.css");
I just want the url /style/style.css to point to another static file on the webserver..
I'm getting this error:
There is no build provider registered for the extension '.css'. You can register one in the <compilation><buildProviders> section in machine.config or web.config. Make sure is has a BuildProviderAppliesToAttribute attribute which includes the value 'Web' or 'All'.
View 5 Replies
Nov 30, 2010
Response.RedirectPermanent(Url); can redirect permanently to a url.
However, during my SEO process, I decided to change my routhing rule.
For example,
I change "/tag/{tag}-quotes" routing rule to "quoes-about/{tag}", but I don't want to lose all the traffic to old routing url.
What is the best way to handle this permanent redirection?
View 4 Replies
May 25, 2010
I have a website running on a IIS 7.5 server with ASP.NET 4.0 on a shared host, but in full trust.
The site is a basic "file browser" that allows the visitors to login and have a list of files available to them displayed, and, obviously, download the files. The static files (mostly pdf files) are located in a sub folder on the site called data, e.g. http://example.com/data/...
The site uses ASP.NET form authentication.
My question is: How do I get the ASP.NET engine to handle the requests for the static files in the data folder, so that request for files are authenticated by ASP.NET, and users are not able to deep link to a file and grab files they are not allowed to have?
View 1 Replies
Mar 1, 2011
I am new to MVC. I am using MVC and VS2010. I am trying to publish my website to a remote server. All files are copied except some static pages i have kept inside a folder. for e.g. i have a folder named Content. I have around 5 .pdf files inside this folder and also a .css. When i do Build->Publish <appname> all the files including the .css is copied but not the .pdfs.
View 2 Replies
Jan 26, 2010
I had a look through some of the older questions, but I can't find anything.I have a Wildcard HttpHandler on my web app which is processing the url and working out if it can do anything with itIf it can't, then the StaticFile Handler should pick it up and just serve it as a static file (like an html file).The problem is, it's going through the Wildcard handler, then seemingly not going to the StaticFileHander. Is there something I need to do to the Wildcard handler, or in the web config?This is my web.config:
<add name="Wildcard" path="*" verb="*" type="Rewriter.RewriterHttpModule"
modules="IsapiModule" requireAccess="None" allowPathInfo="false"
preCondition="" responseBufferLimit="4194304" />
<add name="StaticFile" path="*.*" verb="*"
modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule"
scriptProcessor="%windir%Microsoft.NETFrameworkv2.0.50727aspnet_isapi.dll"
resourceType="File" requireAccess="Read" allowPathInfo="false" preCondition=""
responseBufferLimit="4194304" />
View 3 Replies
Oct 29, 2010
I was under the impression that static files (CSS, images, @font-face files, etc) bypassed ASP.NET completely, and were served directly by IIS. However, my BeginRequest event handler is being called for every HTTP request, including those for static files. This concerns me because I'm creating an Entity Framework data context to be used for the lifetime of each request in that event handler. I don't want to create those contexts if they're never going to be used.
I'm using IIS 7 on Windows 7 Ultimate with so special handler mappings defined. Do I have it wrong? Should these events be firing?
View 2 Replies
Nov 2, 2010
I have 2 website on my IIS which have the same physical location on disk. Example:
www.xxx.com path on disk : c:wwwxxx.com
img.xxx.com path on disk : c:wwwxxx.com
I want that img.xxx.com only response for static files like images, css and js files.
My main goal is to serve static files from a cookieless domain (using img.xxx.com for cookieless requests). But if I write img.xxx.com to browser i see the same content with www.xxx.com. I want to block all request to img.xxx.com except images, css and js request.
I don't want to set another folder for img.xxx.com because it is very hard for me to change all images url to new url.
View 3 Replies
Jan 12, 2011
Our old ASP.net site stored static images in a sub directory on the root called /images.
Our new ASP.net MVC site stores these images in the new layout of /Content/Images
I've changed all the pages in the site to cope with the new folder structure, but I'd like to set up Permanent Redirects from the old static images to the new location.
View 1 Replies
Jun 21, 2010
We're having the same setup and receiving the same problem as:
[URL]
Setup
Server 2003 32bit, IIS 6
ASP.NET wild card mapping
A virtual directory mapped to an UNC share serving static images for a CMS in a load balancing environment
My question if it's possible to turn off asp.net from virtual and only serve static files e.g. images in the virtual directory, to avoid the problem with too many open connections?
If it's not possible I'll guess I have to implement a solution like [URL] to server the files from a local disc.
I found a possible solution at [URL] that removes the wild card mapping and makes it possible to turn of execution of asp.net files.
View 1 Replies
Jan 5, 2010
I realise that this is going to be a fairly niche requirement and will almost certainly raise a few "WTF's" but here goes...
Within an ASP.NET Webforms application I need to serve static content from a local client machine in order to reduce up-front bandwidth requirements as much as possible (Security policy has disabled all Browser caching). The idea is to serve CSS, images and JavaScript files from a location on the local file system referenced by filesystem links from within the Web application (Yes, I know, WTF's galore but that's how it is). The application itself will effectively be an Intranet app that's hosted externally from a client but restricted by IP range along with standard username/password security. So it's pretty much a hybrid Internet/Intranet application but we can easily roll out packages of files to client machines. I am not suggesting that we expect nor require public clients to download packages of files. We have control to an extent over the client machines in terms of the local filesystem and so on but we cannot change the caching policy.
We're using UpdatePanel controls to perform partial page updates which obviously means that we need to Microsoft AJAX JavaScript files. Presently these are being served (as standard) by a standard resource handler within IIS/ASP.NET. Ideally I would like to be able to take these JS files and reference them statically from a client machine, and no longer serve them via an AXD.
My questions are:Is this possible?If it is possible, how do we go about doing so?
In order to attempt to pre-empt some WTF's the requirement stems from attempting to service a requirement with as little time and effort as possible whilst a more suitable solution is developed. I'm aware that we can lighten the load, we can switch to jQuery AJAX updates, we can rewrite the front-end in MVC etc. but my question is related to what we can quickly deploy with our existing application architecture.
View 2 Replies
Nov 3, 2010
Does precompilation have any effect on XML files? i.e. can I obscure/protect xml files using precompilation? I assume that it has no effect as they aren't code.
If I use XML files as Embedded Resources, they appear in the DLL in a text editor as normal text. If the dll is edited and saved using a text editor, will it still work if it is unsigned?
View 2 Replies