首页  >  问答  >  正文

apache rewrite 规则问题?

1 hi ,我想实现以下的规则:
所有的请求定位到index.php
所有的资源(图片css啊之类的)直接访问

我的.htaccess 应该要怎么写呢????

滿天的星座滿天的星座2713 天前548

全部回复(1)我来回复

  • 世界只因有你

    世界只因有你2017-05-16 17:02:57

    <IfModule mod_rewrite.c>
     RewriteEngine on
     RewriteCond %{REQUEST_FILENAME} !-d
     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteRule ^(.*)$ index.php [QSA,PT,L]
    </IfModule>
    1. Cond 是这样的。如果存在该文件或者文件夹,那么直接访问。

    2. OK,不存在,则进行Rule 重写,全部指向到index.php

    回复
    0
  • 取消回复