IIS 8.5 HTTP Redirect VS Favicon - iis

Hello!
The issue is that the favicon does not appear when http redirect is active in IIS 8.5.
My OS is windows server 2012 r2, the web browser is IE11.
What I do:
I go to IIS 8.5,click on http redirection, check the first option, enter the http link and then apply. Run iisreset, clear IE cash, reload the page. The favicon.ico is in wwwroot folder.
What I've tried:
-Add mime type in IIS (".ico" = "image/x-icon" or ".ico" = "image/vnd.microsoft.icon")
-Add link in the page (link rel="icon" type="image/x-icon" href="/favicon.ico")
-Different icon generated by a web site.
Please help me!
Thanks
**[EDIT]**
This is how redirect is set in IIS:
--------------------------------
HTTP Redirect
Use the feature to specify rules for redirecting incoming requests to antoher file or URL.
V Redirect requests to this destination :
http://[dnsname]/[folder]/
Redirect Behavior
V Redirect all requests to exact destination (instead of relative to destination)
Only redirect requests to content in this directory (not subdirectories)
Status code :
Found (302)
---------------------------------
In the source page, it's same thing if I add or delete the link tag to the icon.
<html>
<head>
<link rel="icon" type="image/x-icon" href="/favicon.ico">
<head>
<html>

Ok I found a solution. Just put below code in the web.config in the wwwroot directory.
<configuration>
<location path="favicon.ico">
<system.webServer>
<httpRedirect enabled="false" />
</system.webServer>
</location>
</configuration>
Thanks to Mirko Lugano for his help and put me on the right track!

Related

Root of virtual directory is localhost, not localhost/myapp. So all my links are broken

So I'm deploying a website on my local dev machine. I created an application inside Default Web Site. I can hit it with localhost/myapp and it loads index.html. However, all the links (css, js etc) on index.html are calling localhost/whatever.css. It's cutting off the /myapp bit. Is there something I need to add to web.config?
FYI, I'm running Win10. Site created with VS2015. ASPNet5 app.
In your index.html file you would have linked those whatever.css files using absolute path which starts with / - forward slash, like /whatever.css
<link rel="stylesheet" href="/whatever.css">
remove those forward slash for it to look like whatever.css.
<link rel="stylesheet" href="whatever.css">
This will fix the errors.

Set Default Page

I am running IIS 7.5 and in my VS2015 project I have set the start page, I also have set the start page using my webconfig file like so:
<system.webServer>
<defaultDocument enabled="true">
<files>
<add value="~/Page1.aspx" />
</files>
</defaultDocument>
</system.webServer>
But anytime I try to browse my site I get a
403 - Forbidden: Access is denied
Start --> Run --> inetmgr
Click Your Site
Click Default Document
Add whatevs the name of your start-up page should be
As far as your comment above, did you update the "Web" file in the root of the drive or the "web" file in the same location as your .aspx pages?

How to install magento in subfolder in localhost

I am trying to install magento from webserver to my localhost. In my localhost magento should stay in a folder as in xampp
htdocs/xxx/web/....
I have copied the database fine. I have copied all the files,, chaged the local.xml file for database etc..
Now when loaded ,I notice that the js/images/cs files in the source code are refercing from root rather than the folder web.. as in
<link rel="stylesheet" type="text/css" href="http://127.0.0.1:9000/prototype/windows/themes/default.css">
whish is definitely wrong.. All links in the source are wrong :( Any help please
I only see 2 ways
1 - you configure your xampp with wamp or subdomain, and the store will be accessed have to change in system / configuration / web url
2 - creates a folder with the name of the subdomain within the magento folder, copy the index.php and paste it in and then change the calls index.php, and the store will be accessed have to change in system / configuration / web url

How can I use an own asp page as 404 error page on a Windows 7 pro IIS 7.5 local installation

I have the following configuration:
Running Windows 7 Pro
Running local IIS 7.5 ( for web development purposes )
Edited hosts file to be able to use http://www.sitestepper.dev
Site build in subfolder of the inetpub/wwwroot/staplijst
Site can be viewed using http://www.sitestepper.dev/staplijst/whatever-page.htm
I have an http://www.sitestepper.dev/p.asp page I would like to call when an unknown page is requested. This technique works fine on the deployed version of this web site (deployed on an Windows 2003 server running IIS 6 - not sure about the 7 but it is the version deployed with Windows 2003 server).
I tried ( in the Edit Custom Error Dialog ) :
Execute a URL on this site: with value /staplijst/p.asp
and
Respond with a 302 redirect: with value http://www.sitestepper.dev/staplijst/p.asp
I tried this in the properties of the 'Default Web Site' , and I tried this at the staplijst level.
Even tried it with values without the /staplijst.
I restarted the default web site after each change. And even stopped/started the Web service.
But nothing seems to work, I keep getting the 'Server Error In Application "DEFAULT WEB SITE"' , HTTP Error 404.0 error.
What am I missing here - probably something obvious, but I don't see it ?
I just configured the following to reproduce your setup:
In the web.config file:
<configuration>
<system.webServer>
<httpErrors>
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404"
prefixLanguageFilePath=""
path="/p.asp"
responseMode="ExecuteURL" />
</httpErrors>
</system.webServer>
</configuration>
In the root of the site I have a simple script called p.asp that does a Response.Write "Hello World".
If I browse to a page that doesn't exist p.asp is redirected to and I see "Hello World".
If I use the following in my web.config:
<httpErrors>
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404"
prefixLanguageFilePath=""
path="http://www.sitestepper.dev/p.asp"
responseMode="Redirect" />
</httpErrors>
This redirects as expected to p.asp and again I see "Hello World".
The only thing I can think that is wrong is that you say that p.asp lives in the root of the site: http://www.sitestepper.dev/p.asp but the ExecuteURL and Redirect response mode paths include /staplijst in the path.
To answer my own question: I needed to set the Error response to Custom error pages in the Edit feature settings... of the relevant site for this to work. It was set to 'Detailed errors for local requests and custom error pages for remote requests'.
I never had to do this in previous version of IIS, but maybe in those versions this was implied. Or maybe the host setting www.sitestepper.dev is causing the pages always to behave as local requests - anyway this has changed in IIS 7.5 I'm sure.
I searched for this solution without seeing the answer of 'Kev'. As a rule I tend not to edit config files directly if a solution can be found using the presented user interface panels.
I will accept his response as solution though.
.

How can I get ErrorDocument in .htaccess to output wrong uri parameter?

I've worked-around the solution to transform all uri to one page via ErrorDocument.
The reason behind this is to send Files AND folders (nice urls) to one page. However, I need the URI string to be sent to index.php?uri=string . Is this possible via ErrorDocument, or how do I do this?
So I need to rewrite the
http://www.something.com/games/specific-game
to
http://www.something.com/index.php?uri=/games/specific-game
Is this possible at all, if, how?
If your server supports server-side include (SSI) then you use the following 404.shtml as your ErrorDocument:
<html>
<header>
<meta http-equiv="Refresh" content="0; url=/index.php?uri=<!--#echo var="REQUEST_URI" -->">
</header>
</html>
EDIT: there is a simpler way: create a PHP file as your ErrorDocument and you can do anything under the sun in it! :)
EDIT2: you can access the original URI using $_SERVER['REQUEST_URI']
EDIT3: heck, if you are just redirecting to index.php on the same host, you can just set that index.php file as your ErrorDocument and detect if the request is redirected from 404 error by checking if $_SERVER['REDIRECT_STATUS'] == '404'

Resources