我想合并这两个htaccess文件。
RewriteEngine On
RewriteCond %{HTTP:HOST} http://example.io/
RewriteCond %{HTTP:Accept-Language} ^es [NC]
RewriteRule ^$ http://example.io/es/[L,R=301]
RewriteCond %{HTTP:Accept-Language} ^en [NC]
RewriteRule ^$ http://example.io/en/ [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(en|es)/?$ [QSA,NC,L]

和另一个
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]

关于如何做到这一点的任何想法?非常感谢你
答案 0 :(得分:0)
你测试过这个吗?这似乎是一个合乎逻辑的起点。它应该抓住你的特殊"而不是文件"在继续前进到底部的所有东西之前的情况。
RewriteEngine On
RewriteCond %{HTTP:HOST} http://example.io/
RewriteCond %{HTTP:Accept-Language} ^es [NC]
RewriteRule ^$ http://example.io/es/[L,R=301]
RewriteCond %{HTTP:Accept-Language} ^en [NC]
RewriteRule ^$ http://example.io/en/ [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(en|es)/?$ [QSA,NC,L]