多语言wordpress网站具有多种语言前缀(si,en,de,...)
1. https://www.example.com
2. https://www.example.com/porfolio/images
3. https://www.example.com/en
4. https://www.example.com/en/porfolio/images
是否存在一个.htaccess脚本,该脚本将在不更改url的情况下将1,2至3,4链接重写?
由于明显的循环,我当前的脚本返回的重定向太多。
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteCond %{REQUEST_URI} !^/en/
RewriteRule ^(.*)$ /en/$1 [L]