We’re running into an issue where the URL rewrites we are using in the child application are not working. I suspect this is due to Composite overriding the rewrites.
Is there a guide to creating child applications under Composite, or a way to tell it to not use the default Composite Rewrite engine for child applications?
The solution we went with was to move the application from being under Composite, to the Root level of the website and took care of any linking issues with rewrites. This will work until a better solution is found.
It isn't Composite-specific, but if the rewrites are in the web.config
It isn't Composite-specific, but if the rewrites are in the web.config (editable through the Composite interface) you should be able to wrap their parent node in a <location> tag:
<location path="." inheritInChildApplications="false">
<system.webServer>
<rewrite>
...
</rewrite>
</system.webServer>
</location>
Related
I have the following situation:
Multiple web sites running on IIS 10.0
Web sites running on the same account of a shared hosting service, so no access to machine.config or other configuration files outside the hosting environment
Each of the web sites share a common set of rewrite rules, but also define their own site specific rewrite rules
Now I want to move the common rewrite rule set to an external file, so it is easier to maintain. Then I want to include these common rule set into the web.config of each site.
I have looked into the following several options, but found out that none of them worked:
Add a configSource attribute to the <rewrite> tag. This does not work, as the <rewrite> does not allow the configSection attribute
Add a configSource attribute to the <rules> tag. This does not allow me to extend the rules for a specific site, as it only reads the configuration from the file that is mentioned in the configSource attribute
Add a file attribute to the <rules> tag. This did not process the rules in the external file. Maybe the format of my external is incorrect then (see below for how this last option is configured).
When using the file attribute my web.config was looking like this (only the relevant parts are shown):
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
...
<rewrite>
<rules file="rules.config" />
<!-- here I want to add some additional rules, but they were not there during my initial tests -->
</rewrite>
...
</system.webServer>
</configuration>
My rules.config was like this (only relevant parts shown):
<?xml version="1.0" encoding="UTF-8"?>
<rules>
<clear />
<rule ...>
...
</rule>
</rules>
Is there a way to accomplish what I want? As mentioned above, I do not have access to the IIS configuration files outside of my hosting environment, so I cannot place common rules in the machine.config or the ApplicationHost.config files.
I want to create a default document called default and in that document I want it to rewrite the URL so instead of going www.bob.com it should instead go to www.bob.com/uv
Right now this is being done through URL rewrite rules, with patterns and all kinds of complications. I saw this done directly in the default document once, I cant remember if it was default.htm or .html or .aspx, using one line of code and I was very intrigued but I have not found it since then and no good examples have come up in my google searching. Does anyone have a link or could write the single line of code to add \uv to the url? Is there a really good example of it anywhere?
You can add which ever default page you want from IIS Manager -> -> Default Document - > Add (on right side) or by adding below in your web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<add value="default.aspx" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
However this is a rewrite i.e. this will load default.aspx when you browse www.bob.com (URL remains same but the page is actually loaded).
If you want to actually change the URL (redirect) then with the same configuration above this below line in default.aspx
<%Response.Redirect("home.aspx")%>
I just added a CFwheels site to my IIS 8 and instead of going to the actual page is showing the directory structure on the browser. Any hints on what I should check?
Geo,
Your problem is the default document settings as Anit has suggested. In the IIS8 control pannel look for a cpl called "default document". It will show a list of documents that are served by "Default" so that when you navigate to something.com/home it actually serves up something.com/home/index.cfm (as an example).
Make sure you add your desired default document to the list. You can aslo do this in the web.config file:
<configuration>
<system.webServer>
<defaultDocument enabled="true">
<files>
<add value="index.cfm" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
You are correct I think that if it is an Adobe AMI it should have such a setting by default - but perhaps you are not using a standard default doc.
You probably want to disable directory browsing as well - that's also a cpl I think.
We have a problem occuring on some of our developer workstations: when visiting a URL without a filename (e.g. http://localhost/), IIS 7 returns a 404 error. Everyone is running Windows 7/IIS 7.5 and ASP.NET 4.0. The application pool is configured to use Classic pipeline mode.
Default documents are enabled, and default.aspx is in the default document list.
I enabled failed request tracing, and see this in the log:
OldHandlerName="", NewHandlerName="ExtensionlessUrl-ISAPI-4.0_64bit",
NewHandlerModules="IsapiModule",
NewHandlerScriptProcessor="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll", NewHandlerType=""
Later on, I see that this IsapiModule is rejecting the request:
ModuleName="IsapiModule", Notification="EXECUTE_REQUEST_HANDLER", HttpStatus="404",
HttpReason="Not Found", HttpSubStatus="0",
ErrorCode="The operation completed successfully. (0x0)", ConfigExceptionInfo=""
It looks like IIS thinks the ExtensionlessUrl-ISAPI-4.0-64bit should be handling the request. When I look at that module's configuration, it shows that it should be matching path *., so I'm confused why it is matching no path.
A Google search turns up this post on the IIS.net forums from 2005. Unfortunately, no solutions are offered, just an acknowledgement of the problem.
When I update my app pool to use integrated mode, the problem goes away. Unfortunately, it has to run in Classic mode.
What can I do to get IIS to server our default documents again?
It looks like Microsoft released an update that enables the ExtensionlessURL HTTP handler to work with extensionless URLs. Unfortunately, this breaks certain other handlers. In my case, the DefaultDocument handler under classic app pools. The solution is to remove the ExtensionlessURL handlers in our application's web.config:
<system.webServer>
<handlers>
<remove name="ExtensionlessUrl-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrl-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrl-Integrated-4.0" />
</handlers>
</system.webServer>
I solved the problem with putting the "StaticFile" handler in HandlerMapping in front of "ExtensionlessUrlHandler-*"
I noticed when removing the managed .NET framework (4.0) from the application pool, it fixed the problem for me too!
We don't use .NET at all in our IIS environment!
I use the following rule in web.config URL Redirect as workaround to solve this:
<system.webServer>
<rewrite>
<rules>
<rule name="Default document rewrite" stopProcessing="true">
<match url="^(.+/)?$" />
<action type="Redirect" url="https://{HTTP_HOST}/default.aspx" />
</rule>
</rules>
</rewrite>
</system.webServer>
Changing the StaticFile order helped to fix the issue, when setting default document to a web site application in IIS, while the root website also had another default document.
Adding the DefaultDocument component to IIS in add/remove windows features and then inserting the name of my default script ( index.php) worked for me.
When used at site level, the IIS7 URL Rewrite 2 module saves its configuration in the web.config file of that site. I'm using Sitecore CMS, and best practice is to store any web.config customisations in a separate config file for ease of upgrading, staging/production setups etc.
Is there any way to specify a different config file for IIS7 redirects?
I know that application-level rewrites are stored in ApplicationHost.config, but I have several sites running on the server and would like to keep them separated.
Thanks, Adam
In order to support this best practice you've mentioned, Sitecore implements pluggable configs, but only for the elements inside <sitecore> section of web.config. So, unless IIS7 URL rewrite provides some way to move its stuff to a separate config (like ASP.NET does for connectionstrings.config), I'm afraid you'll have to keep it in the main web.config file.
Sorry if I'm saying obvious things.
You can also try to use rewrite maps
<rewrite>
<rewriteMaps configSource="rewriteMaps.config" />
</rewrite>
Sample rewriteMaps.config file:
<rewriteMaps>
<rewriteMap name="CustomRewrites" defaultValue="">
<add key="/instructions" value="/documents" />
</rewriteMap>
</rewriteMaps>
I'm not familiar with the url rewriting config, but I have an example of moving the url mapping to a separate file:
<urlMappings configSource="config\urlMappings.config"></urlMappings>
And that file looks like the following:
<?xml version="1.0"?>
<urlMappings enabled="true">
<add url="~/somedealer" mappedUrl="/?theme=4" />
<add url="~/someotherclient" mappedUrl="/?theme=12" />
</urlMappings>
I'm sure the url rewriting works the same way.