Redirect requests only if the file is not found?

后端 未结 6 1395
借酒劲吻你
借酒劲吻你 2020-11-28 08:23

I\'m hoping there is a way to do this with mod_rewrite and Apache, but maybe there is another way to consider too.

On my site, I have directories set up for re-skinn

6条回答
  •  隐瞒了意图╮
    2020-11-28 08:54

    How about this?

    # If requested resource exists as a file or directory go to it
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule (.*) - [L]
    
    # Else rewrite requests for non-existent resources to /index.php
    RewriteRule (.*) /index.php?q=$1 [L]
    

提交回复
热议问题