0

I want to Redirect 404 error page to index.php page since we have completely renamed all urls.. We are using PHP and the server is Windows.. We can do this in .htaccess file on Linux server.. But no idea How to do it in Windows.. Please help. This is the Question Simillar to my Question

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
    <httpErrors>
        <error statusCode="500" subStatusCode="100" path="/iisHelp/500-100.asp" responseMode="ExecuteURL" />
    </httpErrors>
</system.webServer>
<system.web>
    <customErrors mode="Off">
        <error statusCode="404" redirect="/index.html" />
    </customErrors>
</system.web>
<system.net>
    <mailSettings>
        <smtp deliveryMethod="Network" from="postmaster@embassyresidency.com">
            <network defaultCredentials="true" host="embassyresidency.com" />
            <specifiedPickupDirectory pickupDirectoryLocation="C:\inetpub\mailroot\Pickup" />
        </smtp>
    </mailSettings>
</system.net>

I've used this code in web.config. But redirection is not working.. Any other ideas..

Community
  • 1
  • 1
Rakesh
  • 400
  • 2
  • 5
  • 19
  • 1
    This will help you maybe - http://www.iis.net/learn/application-frameworks/install-and-configure-php-applications-on-iis/translate-htaccess-content-to-iis-webconfig – Hrvoje Golcic Dec 02 '13 at 09:07

3 Answers3

1

If you're running a Windows Server with Apache httpd you can use .htaccess files as well as in Linux.

If you're using the Windows Server IIS you can use web.config files.

You can take a look here for more information how to configure web.config files to redirect on 404 errors.

Maybe this is what you searching for.

Community
  • 1
  • 1
Maarkoize
  • 2,601
  • 2
  • 16
  • 34
  • Already the directory has web.cofig file in it. So I guess the server is Windows Server IIS. I've made some changes but still not workong.. – Rakesh Dec 02 '13 at 09:58
  • What changes did you tried? And have you restart the IIS after changes? – Maarkoize Dec 02 '13 at 10:09
0

If you have apache the same .htaccess file should work.

James
  • 81
  • 4
0

Use this code:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <httpErrors>
            <remove statusCode="404" subStatusCode="-1" />
            <error statusCode="404" prefixLanguageFilePath="" path="error\404.php" />
         </httpErrors>
    </system.webServer>
</configuration>