tonelm54
asked on
web.config redirect all requests
Is it possible to redirect all my web requests to index.htm ? From looking at forums, Ive managed to get together:-
However all I get is:-
Im hoping that once the page has been redirected I can query the requested page,
<?xml version="1.0"?>
<configuration>
<system.web>
<rule name="rule 1g" stopProcessing="true">
<match url="." />
<action type="Rewrite" url="/index.php" />
</rule>
</system.web>
</configuration>
However all I get is:-
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Im hoping that once the page has been redirected I can query the requested page,
ASKER
When I try your example I dont get the same error but instead get:-
This webpage has a redirect loop
Oops my bad I forgot to specifiy a resource type (*.htm)
<configuration>
<system.webServer>
<httpRedirect enabled="true" exactDestination="true" httpResponseStatus="Found" >
<add wildcard="*.htm" destination="/index.php" />
</httpRedirect>
</system.webServer>
</configuration>
<configuration>
<system.webServer>
<httpRedirect enabled="true" exactDestination="true" httpResponseStatus="Found"
<add wildcard="*.htm" destination="/index.php" />
</httpRedirect>
</system.webServer>
</configuration>
ASKER
I was hoping to do all pages, so using your example something like this:-
Sorry to keep hasseling you, Im just finding resources very slim, and help files not helpful on web.config files
<configuration>
<system.webServer>
<httpRedirect enabled="true" exactDestination="true" httpResponseStatus="Found">
<add wildcard="index.php" StopProcessing="true" />
<add wildcard="*.jpg" StopProcessing="true" />
<add wildcard="*.png" StopProcessing="true" />
<add wildcard="*.js" StopProcessing="true" />
<add wildcard="*" destination="/index.php" />
</httpRedirect>
</system.webServer>
</configuration>
Sorry to keep hasseling you, Im just finding resources very slim, and help files not helpful on web.config files
Hi
The following should redirect all pages , without having to specify all of them
Which version of iis are you using ?
and you may also find this Microsoft Web Page show how to do this through the GUI
The following should redirect all pages , without having to specify all of them
Which version of iis are you using ?
and you may also find this Microsoft Web Page show how to do this through the GUI
<configuration>
<location>
<system.webServer>
<httpRedirect enabled="true" destination="http://www.newWebSite.com/" httpResponseStatus="Permanent" />
</system.webServer>
</location>
</configuration>
ASKER
The problem I have found with this redirect is that it redirects everything to index.php, including index.php and any js or css files I have
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window
I am assuming of course that you are asking to redirect all requests to index.php ?