How can I delete .html and .php extension?

IIS is convenience web server which is used in windows.

Let's set the security configuration by setting web.config

*the warning!
You must download url rewite 2.0




1.delete .html extention
<rule name="html redirection" stopProcessing="true">
     <match url="^(.*).html$" />
               <conditions>
                    <add input="{URL}" pattern="(.*).html$" />
               </conditions>
     <action type="Redirect" url="{R:1}" />
</rule>
Ctrl+c this codes and Ctrl+v at your website's web.config
This option is .html delete redirection. Let me show the example.
ex)
https://magsty.net/index.html -> https://magsty.net/index

You can use this code for other extension like .php or .jsp

2.delete .php extension
<rule name="html redirection" stopProcessing="true">
     <match url="^(.*).php$" />
               <conditions>
                    <add input="{URL}" pattern="(.*).php$" />
               </conditions>
     <action type="Redirect" url="{R:1}" />
</rule>
Ctrl+c this codes and Ctrl+v at your website's web.config
This option is .html delete redirection. Let me show the example.
ex)
https://magsty.net/index.php -> https://magsty.net/index


3.delete .jsp extension
<rule name="html redirection" stopProcessing="true">
     <match url="^(.*).jsp$" />
               <conditions>
                    <add input="{URL}" pattern="(.*).jsp$" />
               </conditions>
     <action type="Redirect" url="{R:1}" />
</rule>

Ctrl+c this codes and Ctrl+v at your website's web.config
This option is .html delete redirection. Let me show the example.
ex)
https://magsty.net/index.jsp -> https://magsty.net/index


Thanks for watching and write the commet to rewrite request or question

Post a Comment

0 Comments

recent post