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

前端 未结 4 1444
生来不讨喜
生来不讨喜 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:38

    Try this:

    # Loads files from production server
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule (library1|library2)/(.*)$ http://production.com/$1/$2 [R=302,L,NC]
    

    To achieve this:

    something.dev/library1/style.css -> production.com/library1/style.css something.dev/library2/vendor/css/style.css -> production.com/library2/vendor/css/style.css

提交回复
热议问题