Mod rewrite mod_将不同的URI重写到一个位置

Mod rewrite mod_将不同的URI重写到一个位置,mod-rewrite,redirect,url-rewriting,Mod Rewrite,Redirect,Url Rewriting,我正在努力解决可能相当简单的mod_重写tak 这是我的目录结构: 根\ 翻译\ en\包含包含文件的各种子文件夹,2级深 fr\包含各种文件的子文件夹,深度为2级 我想做的是将各种动态创建的URL指向这些特定位置,而不更改地址栏中的URL 例如: mydomain.com/one/ mydomain.com/two/ mydomain.com/three/ ->所有人都将从/root/translations/en/index.php读取内容 ->将从/root/translations

我正在努力解决可能相当简单的mod_重写tak

这是我的目录结构:

根\ 翻译\ en\包含包含文件的各种子文件夹,2级深 fr\包含各种文件的子文件夹,深度为2级 我想做的是将各种动态创建的URL指向这些特定位置,而不更改地址栏中的URL

例如:

mydomain.com/one/ 
mydomain.com/two/ 
mydomain.com/three/
->所有人都将从/root/translations/en/index.php读取内容

->将从/root/translations/en/sub1/sub2/index.php读取内容

->所有人都将从/root/translations/fr/index.php读取内容

->将从/root/translations/fr/sub1/sub2/index.php读取内容

我试过这样的方法:

RewriteCond %{REQUEST_URI} !\.css$ [NC]
RewriteRule ^/(one|two|three)/$ /_translations/en/ [L]

RewriteCond %{REQUEST_URI} !\.css$ [NC]
RewriteRule ^/(onefr|twofr|threefr)/$ /_translations/fr/ [L]
虽然它适用于默认重定向,例如mydomain.com/one/但当我想深入时,它抛出404

有什么线索吗?

试试这些规则:

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]

RewriteRule ^/(one|two|three)/(.*) /_translations/en/$2 [L]

RewriteRule ^/(one|two|three)fr/(.*) /_translations/fr/$2 [L]

第一条规则将停止任何可以映射到现有文件并由以下任何规则重写的请求。另外两条规则适用于您描述的两种情况。

这正是我需要的!非常感谢。
mydomain.com/onefr/sub1/sub2/
mydomain.com/twofr/sub1/sub2/
mydomain.com/threefr/sub1/sub2/
RewriteCond %{REQUEST_URI} !\.css$ [NC]
RewriteRule ^/(one|two|three)/$ /_translations/en/ [L]

RewriteCond %{REQUEST_URI} !\.css$ [NC]
RewriteRule ^/(onefr|twofr|threefr)/$ /_translations/fr/ [L]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]

RewriteRule ^/(one|two|three)/(.*) /_translations/en/$2 [L]

RewriteRule ^/(one|two|three)fr/(.*) /_translations/fr/$2 [L]