Categories
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.
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:
After the change in the web.config file we get the following url and page:
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"?> <
-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"?> <
input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions>
; <action type=