ci框架里rewrite示例 本人qq群也有许多的技术文档,希望可以为你提供一些帮助(非技术的勿加)。

ci里新建应用app,入口文件app.php。

Nginx

这里附上vhost配置

app.52fhy.com.conf

server {
    listen       80;
    server_name  app.52fhy.com;
    index app.php;
    root /www/test/ci/;
    
    location ~ .*.(php|php5)?$
    {
        #fastcgi_pass  unix:/tmp/php-cgi.sock;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index app.php;
        include fastcgi.conf;
    }
    
    location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
    {
        expires 30d;
    }
    
    location ~ .*.(js|css)?$
    {
        expires 1h;
    }

    location / {
      if (!-e $request_filename) {
                rewrite ^/(.*)$ /app.php?/$1 last;
                break;
          }
    }
    
    access_log  /www/log/nginx/access/app.52fhy.com.log;
}

nginx重启命令为:

/usr/local/nginx/sbin/nginx -s reload

url访问示例:

http://app.52fhy.com/Test/hello

实际url为

http://app.52fhy.com/app.php/Test/hello

实现了隐藏入口文件的功能。

Apache

<IfModule mod_rewrite.c>
  Options +FollowSymlinks
  RewriteEngine On

  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ /app.php/$1 [QSA,PT,L]
</IfModule>



个人公众号谢谢各位老铁支持

ci框架里rewrite示例
本人qq群也有许多的技术文档,希望可以为你提供一些帮助(非技术的勿加)。

QQ群:   281442983 (点击链接加入群:http://jq.qq.com/?_wv=1027&k=29LoD19)

我的淘宝店,可以进去逛逛噢:https://shop108912636.taobao.com/index.htm?spm=2013.1.w5001-7867000954.3.1d29318dPlLar7&scene=taobao_shop

 

ci里新建应用app,入口文件app.php。

Nginx

这里附上vhost配置

app.52fhy.com.conf

server {
    listen       80;
    server_name  app.52fhy.com;
    index app.php;
    root /www/test/ci/;
    
    location ~ .*.(php|php5)?$
    {
        #fastcgi_pass  unix:/tmp/php-cgi.sock;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index app.php;
        include fastcgi.conf;
    }
    
    location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
    {
        expires 30d;
    }
    
    location ~ .*.(js|css)?$
    {
        expires 1h;
    }

    location / {
      if (!-e $request_filename) {
                rewrite ^/(.*)$ /app.php?/$1 last;
                break;
          }
    }
    
    access_log  /www/log/nginx/access/app.52fhy.com.log;
}

nginx重启命令为:

/usr/local/nginx/sbin/nginx -s reload

url访问示例:

http://app.52fhy.com/Test/hello

实际url为

http://app.52fhy.com/app.php/Test/hello

实现了隐藏入口文件的功能。

Apache

<IfModule mod_rewrite.c>
  Options +FollowSymlinks
  RewriteEngine On

  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ /app.php/$1 [QSA,PT,L]
</IfModule>



个人公众号谢谢各位老铁支持

ci框架里rewrite示例
本人qq群也有许多的技术文档,希望可以为你提供一些帮助(非技术的勿加)。

QQ群:   281442983 (点击链接加入群:http://jq.qq.com/?_wv=1027&k=29LoD19)

我的淘宝店,可以进去逛逛噢:https://shop108912636.taobao.com/index.htm?spm=2013.1.w5001-7867000954.3.1d29318dPlLar7&scene=taobao_shop