ASP Wrong redirection after edit web.config - asp.net

I try to edit the URL for homepage of an old ASP website. The file is Default.aspx and the current URL is /homepage.
I edit the web.config like this for use the new (test) URL /homepage123
<rule name="RedirectHomepage" stopProcessing="true">
<match url="^Default\.aspx$" />
<conditions>
<add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" />
</conditions>
<action type="Redirect" url="homepage123" appendQueryString="false" />
</rule>
<rule name="RewriteHomepage" stopProcessing="true">
<match url="homepage123" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="Default.aspx" />
</rule>
My problem is /homepage123 don't work when I launch the app in visual studio.
When I try to reach Default.aspx, I am always redirected to /homepage

If using IIS 7 or IIS 7.5 you can set the defaultDocument in webconfig file
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="homepage123.aspx" />
</files>
</defaultDocument>
</system.webServer>

Related

After hosting angular application on iis server direct url is not working it or page refresh on enter is not working

Please find web.config code
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="AngularJS" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
whenever I enter URL ex myapp/orderform it always renders to home or give errors that file or directory does not exist.

Wordpress Permalink for Application

Please read this first:
When i activate my custom permalinks on main blog, everything works well.
But i activate permalinks on sub blog, nothing works even wp-admin panel. I got 500 error.
I have blog on main website on IIS and opened new application under this. I load my wordpress on this applcation without any problem. But when i activated permalinks for this application too, i got 404 error.
My main website config;
Permalink pattern = /%category%/%post-name%/
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Main Rule" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
<rule name="wordpress" patternSyntax="Wildcard">
<match url=".*"/>
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
<staticContent>
<remove fileExtension=".svg" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
</staticContent>
<modules>
<remove name="RewriteModule" />
<add name="RewriteModule" />
</modules>
</system.webServer>
<location path="analytics"></location>
</configuration>
As you can see i have main-web-site/analytics for my sub blog. All permalinks works fine on main website but not working on sub blog. When i activate permalinks, sub website creating web.config file and after that i got 500 error. After i delete this web.config file, i can browse on sub blog but when i click to links i got 404 error.
and this is my sub-blog web config;
Permalink pattern : /archives/%category%/%post-name%
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="wordpress" patternSyntax="Wildcard">
<match url="*"/>
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
</conditions>
<action type="Rewrite" url="index.php"/>
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Any helps would be nice.
Thanks already! :)

redirect issue on webconfig file

please check sfveinaesthetics.com/index.php opens but http://sfveinaesthetics.com/ dont.. its a wordpress site in iis7 server.
inner pages work http://sfveinaesthetics.com/about-us/ fine..
Please get a me solution asap.. web config is like
<system.webServer>
<rewrite>
<rules>
<rule name="Main Rule" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:0}" />
</rule>
</rules>
</rewrite>
</system.webServer>
Not sure if it's causing the problem but the default rewrite rule for Wordpress does not include the /{R:0} part in the rewrite action. Normally it's:
<action type="Rewrite" url="index.php" />

Configure IIS URL Rewrite module for AngularJS HTML5Mode Still Not Working

I have searched at found some info on configuring IIS URL Rewrite module to work with AngularJS HTML5Mode and even tried the info I found on another question:
How do I configure IIS for URL Rewriting an AngularJS application in HTML5 mode?
I've made the changes to my IIS as displayed in the question found in the link above and set the base URL and the site works when I visit the root site (i.e. http: //localhost/appname/). All of my views and the routing works fine.
However; when I try to visit a specific URL (i.e. http: //localhost/appname/about) in a new tab or browser window, I get a 404. Is there something else I'm missing???
I'm running Windows 7, IIS 7 with the URL Rewrite Module installed.
** I had to space the protocol out to allow the example URL to be accepted.
Install this extension: https://www.iis.net/downloads/microsoft/url-rewrite
And add this to web.config under system.webServer
<rewrite>
<rules>
<clear />
<rule name="Html5Mode" enabled="true" stopProcessing="true">
<match url="^(.+)$" negate="true" />
<conditions>
<add input="{REQUEST_URL}" pattern="^(.+)$" negate="true" />
</conditions>
<action type="Rewrite" url="/index.html" logRewrittenUrl="true"/>
</rule>
<rule name="AngularJS" enabled="true" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
</conditions>
<action type="Rewrite" url="/index.html" />
</rule>
</rules>
</rewrite>
Here is the full web.config including serving static files.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear />
<rule name="Html5Mode" enabled="true" stopProcessing="true">
<match url="^(.+)$" negate="true" />
<conditions>
<add input="{REQUEST_URL}" pattern="^(.+)$" negate="true" />
</conditions>
<action type="Rewrite" url="/index.html" logRewrittenUrl="true"/>
</rule>
<rule name="AngularJS" enabled="true" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
</conditions>
<action type="Rewrite" url="/index.html" />
</rule>
</rules>
</rewrite>
<handlers>
<clear />
<add
name="StaticFile"
path="*" verb="*"
modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule"
resourceType="Either"
requireAccess="Read" />
</handlers>
<staticContent>
<mimeMap fileExtension=".*" mimeType="application/octet-stream" />
</staticContent>
</system.webServer>
</configuration>

Wordpress blog inside another [permalinks]

I have a question about having two blogs at the same host simultaneously. Here is my scenario:
The first blog is hosted in the root directory http://mathosproject.com/, and the second is hosted in a sub directory, http://blog.mathosproject.com/, which is linked to http://mathosproject.com/blog/.
I have tried to manipulate the web.config file of the root, by making it excluding the directory blog as following:
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="wordpress8" patternSyntax="Wildcard">
<match url="^(blog|sample-page)*" ignoreCase="true" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="^/(blog|index)" negate="true" />
</conditions>
<action type="Rewrite" url="blog/index.php" />
</rule>
<rule name="wordpress" patternSyntax="Wildcard">
<match url="*" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="^/(blog|index)" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
This actually helped me to be able to view the second blog, in blog, but as I processed to the sample-page, I was redirected to the first blog.
My question is, is there a way I can configure the web.config, so that it excludes a folder entirely?
Thank you in advance,
Artem
I guess this is so late but have answer so posting it.
In subdirectory blog, edit the web.config and put <Clear/> just after <rules> element.
That will make your both the blogs working fine.

Resources