2
Hallo ich möchte eine benutzerdefinierte Weiterleitung über Htaccess.benutzerdefinierte Umleitung nur für spezielles Format über htaccess
für nur dieses Format
www.example.com/index.php?id=abc --> www.example.com/abc
aber für ein anderes Format keine Änderung:
zum Beispiel
www.example.com/index.php?id=abc&id2=qaz --> www.example.com/index.php?id=abc&id2=qaz
Dieser Code (von @starkeen) tut es toll:
RewriteEngine on
#1)Redirect "/index.php?id=foo" to "/foo"#
RewriteCond %{THE_REQUEST} /(?:index\.php)?\?id=([^\s&]+)\sHTTP [NC]
RewriteRule^/%1? [L,R]
#2)The rule bellow will internally map "/foo" to "/index.php?id=foo"#
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/?$ /index.php?id=$1 [L]
Wie kann ich nun einen benutzerdefinierten Parameternamen wie id2 (oder mehr) hinzufügen?
zum Beispiel
www.example.com/index.php?id=abc --> www.example.com/abc
www.example.com/index.php?id=abc&id2=qaz --> www.example.com/abc/qaz
Aber (hier) für diese keine Änderung:
www.example.com/index.php?id=abc&id2=qaz&id3=wsx --> www.example.com/index.php?id=abc&id2=qaz&id3=wsx