apache:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<IfModule mod_rewrite.c>   
   
   
Options +FollowSymLinks  
IndexIgnore */*  
RewriteEngine on  
   
if  a directory  or  a file exists,  use  it directly  
RewriteCond %{REQUEST_FILENAME} !-f  
RewriteCond %{REQUEST_FILENAME} !-d  
   
# otherwise forward it to index.php  
RewriteRule . index.php  
   
</IfModule>


nginx:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
location / {
             try_files  $uri  $uri / /index.php? $args ;
         }
         location ~ [^/]\.php(/|$)
         {
             # comment try_files  $uri  =404; to enable  pathinfo
             try_files  $uri  =404;
             #fastcgi_pass  unix:/tmp/php-cgi.sock;
             fastcgi_pass  192.168.41.249:9000;
             fastcgi_index index.php;
             include  fastcgi.conf;
             # include  pathinfo .conf;
         }
 
         location ~ /(\.svn|\.git|\.ht|\.DS) {
             deny all;
             internal;
         }
         location ~ /( protected |framework|nbproject|themes/\w+/views|index-test\.php) {
             deny all;
             for  production
             internal;
             log_not_found off;
             access_log off;
         }
         location ~* \.(js|css|png|jpg|jpeg|gif|ico|bmp|swf)$ {
              expires 30d;
              log_not_found off;
         }
 
         location ~ .*\.(js|css)?$
         {
             expires      12h;
         }
 
         location = /favicon.ico {
             log_not_found off;
             access_log off;
         }
 
         location = /robots.txt {
             allow all;
             log_not_found off;
             access_log off;
         }