htaccess,请求uri不会重定向

时间:2015-01-28 17:30:28

标签: apache .htaccess mod-rewrite

如果请求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]

1 个答案:

答案 0 :(得分:0)

您可以使用:

RewriteEngine on

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

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

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

相关问题