我真的不知道如何解释这种情况,但我试一试。所以,我有这个网址: http://localhost/static/some_picture.png,我的文件夹看起来像这样:
- 静态/x/picture.png
- 静态/y/logo.png
我想要的是,如果用户键入提到的 url,他将看到“statics/x/picture.png”中的“picture.png”,但如果他键入http://localhost/static/some_logo。 png然后他将在“statics/y/logo.png”中看到“logo.png”。
我的最后一次尝试:
RewriteEngine On
RewriteCond statics/x/$1 -f
RewriteRule ^static/some_(.*)$ statics/x/$1 [L]
RewriteEngine On
RewriteCond statics/y/$1 -f
RewriteRule ^static/some_(.*)$ statics/y/$1 [L]
目前我有这个.htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule %{REQUEST_FILENAME} ^static/some_(.*)$
RewriteCond %{DOCUMENT_ROOT}/statics/x/%1 -f
RewriteRule ^static/some_(.*)$ statics/x/$1 [L]
RewriteEngine On
RewriteRule %{REQUEST_FILENAME} ^static/some_(.*)$
RewriteCond %{DOCUMENT_ROOT}/statics/y/%1 -f
RewriteRule ^static/some_(.*)$ statics/y/$1 [L]
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>