CI框架CodeIgniter僞靜態各類服務器設置

Apache服務器.htaccess僞靜態設置php

RewriteEngine on  
RewriteCond $1 !^(index\\.php|system\\.php|images|skin|js|ls|swfupload|attachment|application|robots\\.txt)  
RewriteRule ^(.*)$ /fx/index.php/$1 [L]

 

Nginx服務器僞靜態設置css

location / {
        root   /var/www/html/;
        index index.html index.htm index.php;
        if ($request_filename !~* /(js|css|img|uploads|resources|robots\.txt|index\.php)) {
             rewrite ^/(.*)$ /index.php?$1 last; 
        }
}

 注:如在全局設置了root和index,此處就不須要這兩項設置。html

 

IIS服務器web.config僞靜態設置web

 <system.webServer>
    <rewrite>
      <rules>
       <rule name="Imported Rule 1" stopProcessing="true">
          <match url="^/(.*)$" ignoreCase="false" />
          <conditions logicalGrouping="MatchAll">
            <add input="{R:1}" pattern="^(index\.php|images|styles|scripts|uploads|resources|robots\.txt)" ignoreCase="false" negate="true" />
          </conditions>
          <action type="Rewrite" url="/index.php/{R:1}" />
        </rule>
      </rules>
    </rewrite>        
  </system.webServer>

 

httd.ini僞靜態設置服務器

RewriteRule ^/(?:images|styles|scripts|uploads|resources)/(.*) $0 [L]
RewriteRule ^/(.*)$              /$1/index.php/$2  [L]
相關文章
相關標籤/搜索