yii 1.1.*伪静态配置

apache:

<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:

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;
        }
时间: 2024-08-07 00:18:50

yii 1.1.*伪静态配置的相关文章

Nginx伪静态配置和常用Rewrite伪静态规则

伪静态是一种可以把文件后缀改成任何可能的一种方法,如果我想把php文件伪静态成html文件,这种相当简单的,下面来介绍nginx 伪静态配置方法有需要了解的朋友可参考. nginx里使用伪静态是直接在nginx.conf 中写规则的,并不需要像apache要开启写模块(mod_rewrite)才能进行伪静态. nginx只需要打开nginx.conf配置文件,在server里面写需要的规则即可. 代码如下: server { listen       80; server_name  haha.

DZ 3.2 URL 伪静态配置 教程

原文转自:http://www.zccode.com/thread-682-1-1.html 教程说明: 1 首先需要下载URL重写工具,拷到服务器下面安装即可,这里配置IIS7(x64)伪静态. 工具下载地址:https://www.microsoft.com/zh-CN/download/details.aspx?id=7435 2 将伪静态规则web.config文件拷到论坛根目录下面,这样url伪静态配置就完成了. 3 最后一步,后台管理开启url伪静态,具体流程如下

Web伪静态配置

1. Apache下DISCUZ的伪静态配置参数: Apache Web Server(独立主机用户) <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{QUERY_STRING} ^(.*)$ RewriteRule ^(.*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2&%1 RewriteCond %{QUERY_STRING} ^(.*)$ Rewri

伪静态例子与APACHE伪静态配置

伪静态只是改变了URL的显示形式,实际上还是网站页面还是动态页面.伪静态的页面后缀可以是html . htm 或者是目录格式等.那么为什么要用 伪静态呢? 两点原因:1是seo优化,伪静态有利于搜索引擎的收录,能够增加网站优化效果:2是url看起来简单,网站URL给人专业性. 我们依然是通过.htaccess的文件来实现伪静态.具体的.htaccess设置详见两种apache域名跳转法简单完成重定向中的“2.用.htaccess做域名跳转”. 保证.htaccess文件能用后,我们在.htacc

针对Yii框架的nginx配置

我曾经针对yii制作了 个nginx配置,其中包括了以下几项内容: rewrite规则(try_file),需要nginx0.8.6版本以上支持. 针对于icon, robots.txt文件的日志优化 .svn, .git,等版本控制文件的忽略,以及Mac本身索引文件目录 Yii框架本身应该禁止web访问的目录. 图片等静态文件缓存优化 在这里分享一下demo server { listen 80; server_name youdomain.com; index index.html inde

Yii 1.0 伪静态即Yii配置Url重写

今天学习那个yii的时候,觉得URL太麻烦,想自己配置一下,于是就百度了一下,然后自己总结下,留着后面配置的时候看看. yii框架中有个很重要的组件:URL Management(网址管理) 进行yii伪静态就是只需要配置这个就可以了. 没有配置之前是这个样子的: 配置成功后的URL就是这样的: 第一步:配置URL Management(网址管理) 只需要在config文件夹下面的main.php文件中进行配置就好了 'components' => array( 'urlManager' =>

Yii 1.0 伪静态即Yii配置Url重写(转)

第一步:配置 URL Management(网址管理) 只需要在config文件夹下面的main.php文件中进行配置就好了 'components' => array( 'urlManager' => [ 'showScriptName' => false,//这里是隐藏index.php那个路径的 'urlFormat' => 'path', 'rules' => [ '<controller:\w+>/<id:\d+>' => '<c

Yii框架在Nginx下的rewrite配置(伪静态配置)

在nginx.conf的server 段添加类似如下代码: location / {       if (!-e $request_filename){           rewrite ^/(.*) /index.php last;       }   }

yii第三方插件snoopy配置

首先.把snoopy类放到protected\extensions\snoopy\目录下. 其次.在yii配置文件main.php里配置import扩展进来. 'import'=>array( 'application.extensions.*', ), 然后在一个controller类文件的開始,增加下面行:require_once('snoopy/Snoopy.class.php'); 最后直接实例化对象就ok了 $snoopy = new Snoopy; $snoopy->fetch($