[ad_1]
I’m new to Plesk – Microsoft – IIS, and i have a problem to Rewrite the links on my website,
The original link after swap language it’s something like this:
https://testepages.example.pt/bwd/index.php?lang=PT
After create this code:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect .php extension" stopProcessing="false">
<match url="^(.*).php$" ignoreCase="true" />
<conditions logicalGrouping="MatchAny">
<add input="{URL}" pattern="(.*).php$" ignoreCase="false" />
</conditions>
<action type="Redirect" url="{R:1}" redirectType="Permanent" />
</rule>
<rule name="hide .php extension" stopProcessing="true">
<match url="^(.*)$" ignoreCase="true" />
<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>
</rewrite>
<tracing>
<traceFailedRequests>
<clear />
</traceFailedRequests>
</tracing>
</system.webServer>
<system.web>
<compilation tempDirectory="C:\Inetpub\vhosts\mydomain.pt\tmp" />
</system.web>
</configuration>
All my page links, it’s something like this: https://testepages.example.pt/bwd/index?lang=PT
The extension .php disappear, like I want.
But the final result I want it’s something like this:
https://testepages.example.pt/bwd/index/PT
I create the code to this with URL Friendly from the app IIS Manager, and also I search in stack overflow for people with similar problems,and tried the solutions I found, but I have all the time the same “Error 500, Internal Server Error”
Below, I will put the rules I’ve already tried:
<rule name="Imported Rule 2" stopProcessing="true">
<match url="^(.+)$" ignoreCase="false" />
<conditions>
<add input="%{REQUEST_FILENAME]" matchType="IsDirectory" ignoreCase="false" negate="true" />
<add input="%{REQUEST_FILENAME]" matchType="IsFile" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?lang=pt" appendQueryString="true" />
</rule>
</rules>
And that:
<rule name="RedirectUserFriendlyURL1" stopProcessing="true">
<match url="^testes$" />
<conditions>
<add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" />
<add input="{QUERY_STRING}" pattern="^lang=([^=&]+)$" />
</conditions>
<action type="Redirect" url="{C:1}" appendQueryString="false" />
</rule>
<rule name="RewriteUserFriendlyURL1" stopProcessing="true">
<match url="^([^/]+)/?$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="lang={R:1}" />
</rule>
I’m lost, if anyone can help me or give a light to follow, I will be so glad.
Also, i don’t know how to see the version of IIS i’m using on my storage website.
Thank you.
[ad_2]