How to use mod_Rewrite to check multiple folders for a static file

前端 未结 4 1437
生来不讨喜
生来不讨喜 2021-01-05 14:51

What are the mod_Rewrite rules for checking multiple folder locations for a given file. For instance, if I have a folder structure of:

public/
    css/
             


        
4条回答
  •  情歌与酒
    2021-01-05 15:44

    Try these rules:

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{DOCUMENT_ROOT}/library1%{REQUEST_URI} -f
    RewriteRule ^css/.+ library1%{REQUEST_URI} [L]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{DOCUMENT_ROOT}/library2%{REQUEST_URI} -f
    RewriteRule ^css/.+ library2%{REQUEST_URI} [L]
    

提交回复
热议问题