rewriterule in htaccess to match certain file extensions

前端 未结 2 2154
一个人的身影
一个人的身影 2021-02-13 13:08

How can I look for an instance for certain file extensions, like .(jpg|png|css|js|php), and if there is NOT a match send it to index.php?route=$1.

I would like to be abl

2条回答
  •  感动是毒
    2021-02-13 13:32

    Add an extra RewriteCond to exclude the conditions that you don't want rewritten. Use a ! before the regular expression to indicate that any files matching should fail the condition. The RewriteCond below is untested, but should give you an idea of what you need:

    RewriteCond %{REQUEST_URI} !\.(jpg|png|css|js|php)$
    

提交回复
热议问题