更新时间:2023-11-26 23:36:52
由于您的htaccess位于tournament
文件夹中,因此您可以使用这种方式
Since your htaccess is located in tournament
folder, you can have it this way
RewriteEngine On
RewriteBase /tournament/
# Redirect /tournament/index.php?view=XXX to /tournament/XXX
RewriteCond %{THE_REQUEST} \s/tournament/index\.php\?view=([^&\s]+)\s [NC]
RewriteRule ^ %1? [R=301,L]
# Redirect /tournament/index.php?view=XXX&id=YYY to /tournament/XXX/YYY
RewriteCond %{THE_REQUEST} \s/tournament/index\.php\?view=([^&\s]+)&id=([^&\s]+)\s [NC]
RewriteRule ^ %1/%2? [R=301,L]
# Skip if existing file/folder
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
# Internally rewrite them back
RewriteRule ^([^/]+)$ index.php?view=$1 [L]
RewriteRule ^([^/]+)/([^/]+)$ index.php?view=$1&id=$2 [L]