cla*_*amp 1 mod-rewrite apache-2.2
我是 Apache mod 重写的新手。我想达到的就是这个。
如果从 url 请求图像 (gif, jpg, png) 并且在那里找不到,它应该自动尝试从另一个目录传递此图像。
尝试这个:
RewriteEngine on
# if there's no file at the requested path..
RewriteCond %{REQUEST_FILENAME} !-f
# then, if it's an image file, try the other path:
RewriteRule /([^/]*\.(gif|png|jpg))$ /images/path/$1
Run Code Online (Sandbox Code Playgroud)
这将作用于应用这些规则的每个图像文件请求;仅限于特定的“原始”目录,然后根据需要进行调整:
RewriteRule ^/old/images/path/([^/]*\.(gif|png|jpg))$ /images/path/$1
Run Code Online (Sandbox Code Playgroud)
如果您将其放入.htaccess
或更改RewriteBase
,请相应更改。
归档时间: |
|
查看次数: |
3578 次 |
最近记录: |