ComputerBasForum

Hier tips en tricks

Je bent niet ingelogd.

#1 2019-11-28 01:30:25

Bas
Administrator
Geregistreerd: 2019-11-10
Posts: 79

PHP extensie verwijderen van website url's

PHP extensie verwijderen van website url's

Apache:

#verander https://www.computerbas.nl/ssl.php naar https://www.computerbas.nl/ssl
RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [NC,L]

#verander https://www.computerbas.n/do.html naar https://www.computerbas.nl/do
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html [NC,L]

Als je in IIS met URL Rewrite module de onderstaande regels importeert krijg je hetzelfde (let op die -f):

import rule:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [NC,L]

PHP extensie verwijderen van website url's:

In IIS use URL Rewrite module and import rule:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [NC,L]

en dan krijg je dit:

<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>

smile

Laatst bewerkt door Bas (2022-11-07 04:51:18)

Offline

Forum footer

Powered by FluxBB 1.5.11