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="[email protected]">
            <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..

1

3 Answers 3

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.

2
  • 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 2, 2013 at 9:58
  • What changes did you tried? And have you restart the IIS after changes?
    – Maarkoize
    Dec 2, 2013 at 10:09
0

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

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>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.