Eine alte URL-Struktur meiner Website lautet wie folgt:
https://example.com/login.php or, https://example.com/login.php?redirect=https://example.com or, https://example.com/register.php
Nachdem die URL neu erstellt wurde, sieht die URL so aus:
https://example.com/login or, https://example.com/login?redirect=https://example.com or, https://example.com/register
Wenn ein Benutzer/Besucher nun die alte URL verwendet, https://example.com/login.php
时,我想重定向到 https://example.com/login
die Seite. was soll ich machen?
Zu Ihrer Information, derzeit hat meine .htaccess
-Datei folgenden Inhalt:
AddDefaultCharset UTF-8 ErrorDocument 404 /error-404/ ## Options +FollowSymlinks -MultiViews RewriteEngine on RewriteBase / ## Allow a few SEO Files direct access. RewriteRule ^robots.txt?$ robots.txt [L] RewriteRule ^ads.txt?$ ads.txt [L] RewriteRule ^sellers.json?$ sellers.json [L] ## Avoid rewriting rules for the admin section RewriteRule ^(admin|resources)($|/) - [L] ## Set Ajax Request File RewriteRule ^kahuk-ajax.php?$ kahuk-ajax.php? [L,QSA] ## Set controller with id RewriteRule ^([^/]+)/([0-9]+)/?$ index.php?con=&id= [L,QSA] ## Set controller with slug RewriteRule ^([^/]+)/([^/]+)/?$ index.php?con=&slug= [L,QSA] ## For paging RewriteRule ^([^/]+)/page/([0-9]+)/?$ index.php?con=&page= [L,QSA] RewriteRule ^([^/]+)/([^/]+)/page/([0-9]+)/?$ index.php?con=&slug=&page= [L,QSA] ## Set controller for only one parameter RewriteRule ^page/([^/]+)/?$ index.php?con=page&slug= [L,QSA] RewriteRule ^([^/]+)/?$ index.php?con= [L,QSA] ## Set home page RewriteRule ^/?$ index.php?con=home [L]
您可以在
RewriteBase /
行下方插入此规则来删除.php
扩展名: