How to remove .php extension from web.config file from wordpress root folder

I have static php pages in the wordpress root folder. In the web.config file, I changed the default file to the static php file home.php. I have some static php pages and several Wordpress pages for my site. for wordpress pages changed seo-friendly url using permalinks but static php pages that cannot remove .php extenstions

for example: http://reactore.com/contact-us/ --- wordpress page    http://reactore.com/about-us.php --- static php page

This is my web.config file:

 <rewrite>
            <rules>
                <rule name="WPurls" enabled="true" stopProcessing="true">
                    <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/{R:0}" />
                </rule>
            </rules>
        </rewrite>

click to view web.config file

+4
1

-:

<rewrite>
        <rules>
            <rule name="Imported Rule 1" 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>
        </rules>
    </rewrite>
+4

Source: https://habr.com/ru/post/1625284/


All Articles