开源问答Tipask伪静态apache和nginx设置-阿里云开发者社区

开发者社区> 科技探索者> 正文

开源问答Tipask伪静态apache和nginx设置

简介:
+关注继续查看

[摘要]Tipask是一款开源、SEO友好、扩展性强、性能卓越的问答系统!Tipask 独特的MVC构架,使得二次开发非常容易,多种接口方便和已有系统整合。本文介绍开源问答Tipask伪静态apache和nginx设置。

  第一步:登录tipask后台,seo设置,开启伪静态

  第二步:在Nginx的配置文件nginx.conf 中,加入以下代码实现rewrite。若开启所有规则,则添加如下代码:

tipask安装在web的根目录下的情况

if ($request_filename ~* (.*)\.html){
          rewrite ^/(.*)$  /index.php?$1; 
}

tipask不在web的根目录下的情况

if ($request_filename ~* (.*)\.html){
          rewrite ^(/tipask)/(.*)$ $1/index.php?$2; 
}

  修改以上下语句中的 /tipask 为你的Tipask目录地址即可

第三步:重启nginx,完毕

这个是apache下的rewrite规则

<IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteBase /
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^.*$ index.php?$0</IfModule>

  创建.htaccess这个文件,放到tipask根目录即可,然后后台开启伪静态!.htaccess内容如下:


       [ISAPI_Rewrite]

        # 3600 = 1 hour

        CacheClockRate 3600


        RepeatLimit 32


        RewriteRule ^(.*)/index/default\.html$ $1/index\.php\?index/default.html

        RewriteRule ^(.*)/index\.html$ $1/index\.php\?index/default.html

        RewriteRule ^(.*)/.html$ $1/index\.php\?index/default.html

        RewriteRule ^(.*)/category/view/all\.html$ $1/index\.php\?category/view/all.html

        RewriteRule ^(.*)/c-all\.html$ $1/index\.php\?category/view/all.html

        RewriteRule ^(.*)/c-all/all\.html$ $1/index\.php\?category/view/all.html

        RewriteRule ^(.*)/expert/default\.html$ $1/index\.php\?expert/default.html

        RewriteRule ^(.*)/user/activelist\.html$ $1/index\.php\?user/activelist.html

        RewriteRule ^(.*)/topic/default\.html$ $1/index\.php\?topic/default.html

        RewriteRule ^(.*)/gift/default\.html$ $1/index\.php\?gift/default.html

        RewriteRule ^(.*)/index/help\.html$ $1/index\.php\?index/help.html

        RewriteRule ^(.*)/index/ajaxchkimg\.html$ $1/index\.php\?index/ajaxchkimg.html


        RewriteRule ^(.*)/question/add\.html$ $1/index\.php\?question/add.html

        RewriteRule ^(.*)/question/answer\.html$ $1/index\.php\?question/answer.html

        RewriteRule ^(.*)/question/add/([0-9]+)\.html$ $1/index\.php\?question/add/$2.html

        RewriteRule ^(.*)/question/edit.html$ $1/index\.php\?question/edit.html

        RewriteRule ^(.*)/question/edittag.html$ $1/index\.php\?question/edittag.html

        RewriteRule ^(.*)/question/movecategory.html$ $1/index\.php\?question/movecategory.html

        RewriteRule ^(.*)/question/close/([0-9]+)\.html$ $1/index\.php\?question/close/$2.html

        RewriteRule ^(.*)/question/edit/([0-9]+)\.html$ $1/index\.php\?question/edit/$2.html

        RewriteRule ^(.*)/question/editanswer.html$ $1/index\.php\?question/editanswer.html

        RewriteRule ^(.*)/question/editanswer/([0-9]+)\.html$ $1/index\.php\?question/editanswer/$2.html

        RewriteRule ^(.*)/question/editanswer/([0-9]+)/([0-9]+)\.html$ $1/index\.php\?question/editanswer/$2/$3.html

        RewriteRule ^(.*)/question/delete/([0-9]+)\.html$ $1/index\.php\?question/delete/$2.html

        RewriteRule ^(.*)/question/adopt\.html$ $1/index\.php\?question/adopt.html

        RewriteRule ^(.*)/question/supply\.html$ $1/index\.php\?question/supply.html

        RewriteRule ^(.*)/question/supply/([0-9]+)\.html$ $1/index\.php\?question/supply/$2.html

        RewriteRule ^(.*)/question/appendanswer/([0-9]+)/([0-9]+)\.html$ $1/index\.php\?question/appendanswer/$2/$3.html

        RewriteRule ^(.*)/question/search\.html$ $1/index\.php\?question/search.html

        RewriteRule ^(.*)/question/search/(.*)\.html$ $1/index\.php\?question/search/$2.html

        RewriteRule ^(.*)/question/search/(.*)/([0-9]+)\.html$ $1/index\.php\?question/search/$2/$3.html

        RewriteRule ^(.*)/question/search/tag:(.*)\.html$ $1/index\.php\?question/search/tag:$2.html

        RewriteRule ^(.*)/answer/addcomment\.html$ $1/index\.php\?answer/addcomment.html

        RewriteRule ^(.*)/answer/deletecomment\.html$ $1/index\.php\?answer/deletecomment.html


        RewriteRule ^(.*)/note/list\.html$ $1/index\.php\?note/list.html

        RewriteRule ^(.*)/note/list/([0-9]+)\.html$ $1/index\.php\?note/list/$2.html

        RewriteRule ^(.*)/note/view/([0-9]+)\.html$ $1/index\.php\?note/view/$2.html


        RewriteRule ^(.*)/c-([0-9]+)\.html$ $1/index\.php\?category/view/$2.html

        RewriteRule ^(.*)/l-([0-9]+)\.html$ $1/index\.php\?category/list/$2.html

        RewriteRule ^(.*)/r-([0-9]+)\.html$ $1/index\.php\?category/recommend/$2.html

        RewriteRule ^(.*)/q-([0-9]+)\.html$ $1/index\.php\?question/view/$2.html

        RewriteRule ^(.*)/u-([0-9]+)\.html$ $1/index\.php\?user/space/$2.html

        RewriteRule ^(.*)/us-([0-9]+)\.html$ $1/index\.php\?user/scorelist/$2.html

        RewriteRule ^(.*)/c-([0-9]+)/([0-9]+)\.html$ $1/index\.php\?c-$2/$3.html

        RewriteRule ^(.*)/c-all/([0-9]+)\.html$ $1/index\.php\?c-all/$2.html

        RewriteRule ^(.*)/c-([0-9]+)/all/([0-9]+)\.html$ $1/index\.php\?c-$2/all/$3.html

        RewriteRule ^(.*)/c-all/all/([0-9]+)\.html$ $1/index\.php\?c-all/all/$2.html

        RewriteRule ^(.*)/c-([0-9]+)/all\.html$ $1/index\.php\?c-$2/all\.html

        RewriteRule ^(.*)/c-all/([0-9]+)/([0-9]+)\.html$ $1/index\.php\?c-all/$2/$3.html

        RewriteRule ^(.*)/c-([0-9]+)/([0-9]+)/([0-9]+)\.html$ $1/index\.php\?c-$2/$3/$4.html

        RewriteRule ^(.*)/c-([0-9]+)/([0-9]+)\.html$ $1/index\.php\?c-$2/$3.html

        RewriteRule ^(.*)/l-([0-9]+)/([0-9]+)\.html$ $1/index\.php\?l-$2/$3.html

        RewriteRule ^(.*)/u-([0-9]+)\.html$ $1/index\.php\?u-$2.html

        RewriteRule ^(.*)/r-([0-9]+)\.html$ $1/index\.php\?r-$2.html


        RewriteRule ^(.*)/user/code\.html$ $1/index\.php\?user/code.html

        RewriteRule ^(.*)/user/register\.html$ $1/index\.php\?user/register.html

        RewriteRule ^(.*)/user/default\.html$ $1/index\.php\?user/default.html

        RewriteRule ^(.*)/user/score\.html$ $1/index\.php\?user/score.html

        RewriteRule ^(.*)/user/level\.html$ $1/index\.php\?user/level.html

        RewriteRule ^(.*)/user/profile\.html$ $1/index\.php\?user/profile.html

        RewriteRule ^(.*)/user/uppass\.html$ $1/index\.php\?user/uppass.html

        RewriteRule ^(.*)/user/editimg\.html$ $1/index\.php\?user/editimg.html

        RewriteRule ^(.*)/user/mycategory\.html$ $1/index\.php\?user/mycategory.html

        RewriteRule ^(.*)/message/personal\.html$ $1/index\.php\?message/personal.html

        RewriteRule ^(.*)/message/system\.html$ $1/index\.php\?message/system.html

        RewriteRule ^(.*)/message/send\.html$ $1/index\.php\?message/send.html

        RewriteRule ^(.*)/message/send/([0-9]+)\.html$ $1/index\.php\?message/send/$2.html

        RewriteRule ^(.*)/message/view/system/([0-9]+)\.html$ $1/index\.php\?message/view/system/$2.html

        RewriteRule ^(.*)/message/view/personal/([0-9]+)\.html$ $1/index\.php\?message/view/personal/$2.html

        RewriteRule ^(.*)/user/ask/([0-9]+)\.html$ $1/index\.php\?user/ask/$2.html

        RewriteRule ^(.*)/user/ask/([0-9]+)/([0-9]+)\.html$ $1/index\.php\?user/ask/$2/$3.html

        RewriteRule ^(.*)/user/space_ask/([0-9]+)\.html$ $1/index\.php\?user/space_ask/$2.html

        RewriteRule ^(.*)/user/space_ask/([0-9]+)/([0-9]+)\.html$ $1/index\.php\?user/space_ask/$2/$3.html

        RewriteRule ^(.*)/user/space_ask/([0-9]+)/all/([0-9]+)\.html$ $1/index\.php\?user/space_ask/$2/all/$3.html

        RewriteRule ^(.*)/user/answer/([0-9]+)\.html$ $1/index\.php\?user/answer/$2.html

        RewriteRule ^(.*)/user/answer/([0-9]+)/([0-9]+)\.html$ $1/index\.php\?user/answer/$2/$3.html

        RewriteRule ^(.*)/user/space_answer/([0-9]+)\.html$ $1/index\.php\?user/space_answer/$2.html

        RewriteRule ^(.*)/user/space_answer/([0-9]+)/([0-9]+)\.html$ $1/index\.php\?user/space_answer/$2/$3.html

        RewriteRule ^(.*)/user/space_answer/([0-9]+)/all/([0-9]+)\.html$ $1/index\.php\?user/space_answer/$2/all/$3.html

        RewriteRule ^(.*)/user/activelist/([0-9]+)\.html$ $1/index\.php\?user/activelist/$2.html

        RewriteRule ^(.*)/favorite/default\.html$ $1/index\.php\?favorite/default.html

        RewriteRule ^(.*)/user/login\.html\?*(.*)$ $1/index\.php\?user/login.html

        RewriteRule ^(.*)/user/logout\.html\?*(.*)$ $1/index\.php\?user/logout.html

本文转自奔跑在路上博客51CTO博客,原文链接http://blog.51cto.com/qiangsh/1591346如需转载请自行联系原作者


qianghong000

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

相关文章
eclipse设置代码提示
应用场景 在使用eclipse编辑代码的过程中,每个代码都需要一个一个输入,无法自动进行提示,补全等,代码写起来十分不顺畅,需要设置eclipse代码自动提示和补全,更加方便操作! 操作步骤 打开e...
747 0
一不小心,它成为了 GitHub Alibaba Group 下 Star 最多的开源项目
随着微服务的流行,应用更加轻量和高效,但是带来的困境是线上问题排查越来越复杂困难。传统的 Java 排查问题,需要重启应用再进行调试,但是重启应用之后现场会丢失,问题难以复现。
851 0
Apache设置防盗链
文章来源本人博客 http://blog.teier.cn
1051 0
解读OpenMessaging开源项目,阿里巴巴发起首个分布式消息领域的国际标准
OpenMessaging项目由阿里巴巴发起,与雅虎、滴滴出行、Streamlio公司共同参与创立,项目意在创立厂商无关、平台无关的分布式消息及流处理领域的应用开发标准。据发起人介绍,随着标准的不断演进,会有更多的互联网、云计算厂商参与到该项目以及生态体系中来。
11097 0
Apache设置禁止访问网站目录(目录列表显示文件)
默认apache在当前目录下没有index.html入口就会显示目录。让目录暴露在外面是非常危险的事,如下操作禁止apache显示目录,希望文章对各位有帮助。 进入apache的配置文件 httpd.conf 找到:  代码如下 复制代码 Options Indexes FollowSymLinks 修改为: Options FollowSymLinks 其实就是将Indexes去掉,Indexes表示若当前目录没有index.html就会显示目录结构。
874 0
Apache ShardingSphere:由开源驱动的分布式数据库中间件生态
2021 年 7 月 21 日 2021 亚马逊云科技中国峰会现场,SphereEx 联合创始人、Apache ShardingSphere PMC 潘娟受邀参与此次峰会,以《Apache ShardingSphere 分布式数据库中间件开源生态构建》为主题,围绕开源理念扩散、社区建设、ShardingSphere 如何践行 Apache Way 等方面展开了介绍,本文总结自潘娟内容分享。
76 0
移动硬盘安装ubuntu , 用EasyBCD设置启动引导盘
我的总结如下: 1. ubuntu直接安装在移动硬盘后,重启电脑仍然会直接进入windows7 ,不会进入ubuntu ,也没有任何启动选项。这个时候要用EasyBCD安装Grub启动管理器,加载ubuntu启动项。
5649 0
c++ 静态类成员函数(static member function) vs 名字空间 (namespace)
好多人喜欢把工具函数做成static member function。这样以增加隐蔽性和封装性,由其是从C#,java转而使用c++的开发人员。 例如: class my_math { public: static UINT Hash_XYZ(float x,float ...
584 0
5489
文章
0
问答
文章排行榜
最热
最新
相关电子书
更多
《2021云上架构与运维峰会演讲合集》
立即下载
《零基础CSS入门教程》
立即下载
《零基础HTML入门教程》
立即下载