Url rewrite via the web.config

To rewrite URLs on your site via the web.config file the following steps are required.

There are several ways to achieve the goal, we cover this in Method blocks. Based on your requirements you can choose the best method for you.
If you want to change only 1 page or only a few then method 1 might be the easiest for you.

Method 1

You log into the control panel and go to the file manager.

Depending on your site structure and other issues, the steps below are not applicable to everyone.
This is an example in outline so that you can apply it yourself.
Url rewrite via the web.config

In the picture above you see two pages, Default.htm and test.html
What we want is to rewrite test.html to Default.htm.

If we now open test.html without any changes, we get the following url and page:

Url rewrite via the web.config

After the change in the web.config file we get the following url and page:

Url rewrite via the web.config

You can see that it has been modified so that test.html has been rewritten to Default.htm.

This is written in the web.config file in the following way:

<?xml version="1.0" encoding="UTF-8"?> <
configuration> <system.
webServer> <
;
directoryBrowse enabled="false" /> <rewrite>
; <rules> <
;
rule name="Rewrite
from to"> <match url="test.
html" /> <
;
action type="Rewrite" url="Default.htm" /> <
;
/rule> </rules>
; </rewrite> <
;defaultDocument> <
;
files> <clear /> <
add value="Default.
html" /> <
;
add value="Default.htm" /> <add
value="Default.asp" /> <add value="index
.htm" /> <
;
add value="Default.aspx" /> <add
value="index.html" /> <add value="index
.php" /> <
;
add value="index.asp" /> </files>
; </defaultDocument> </system.webServer> <
;/configuration>--Where Rule
name is the name of the rule.


-Where match url refers to the page whose url is to be rewritten.
--Where action type refers to the type of action, and url to the page where the site should go.

Method 2

This method has the ability to perform a catch all on the incoming URLs, this is similar to how wordpress rewrites the URLs for "pretty permalinks".
So in this way the url will redirect traffic to the url of choice.

<?xml version="1.0" encoding="UTF-8"?> <
configuration> <system.
webServer> <
;
directoryBrowse enabled="false" /> <rewrite>
; <rules> <
rule name="Rewrite
"
> <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> </rules>
; </rewrite> <
;defaultDocument> <
;
files> <clear /> <
add value="Default.
html" /> <
;
add value="Default.htm" /> <add
value="Default.asp" /> <add value="index
.htm" /> <
;
add value="Default.aspx" /> <add
value="index.html" /> <add value="index
.php" /> <add value="index.
asp" /> <
;
/files> </defaultDocument> </system.webServer>
; </configuration>-