htaccess,请求 uri 不会重定向

htaccess, request uri wont redirect

如果请求 uri 是 "de",我想重定向到 "index_de.html",否则每个人都应该重定向到 index.html。为什么我的代码不起作用?

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /index.html [L]

RewriteCond %{REQUEST_URI} ^/de
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.*$ /index_de.html [L]

您可以使用:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^de/.*$ /index_de.html [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ /index.html [L]

在泛型通用类型之前保留更具体的规则。