Use this code in your web config in order to remove extension for URL. This code will also automatically re-write the URL and you don’t have to change the file paths.
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="WordPress Rule" stopProcessing="true"> <match url="^(.*)$" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> <add input="{REQUEST_FILENAME}.php" matchType="IsFile" ignoreCase="false" /> </conditions> <action type="Rewrite" url="{R:1}.php" /> </rule> <rule name="Hide .php ext"> <match ignoreCase="true" url="^(.*)"/> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/> <add input="{REQUEST_FILENAME}.php" matchType="IsFile"/> </conditions> <action type="Rewrite" url="{R:0}.php"/> </rule> <rule name="Redirecting .php ext" stopProcessing="true"> <match url="^(.*).php"/> <conditions logicalGrouping="MatchAny"> <add input="{URL}" pattern="(.*).php"/> </conditions> <action type="Redirect" url="{R:1}"/> </rule> </rules> </rewrite> </system.webServer> </configuration>