天天看點

開源問答Tipask僞靜态apache和nginx設定

[摘要]Tipask是一款開源、SEO友好、擴充性強、性能卓越的問答系統!Tipask 獨特的MVC構架,使得二次開發非常容易,多種接口友善和已有系統整合。本文介紹開源問答Tipask僞靜态apache和nginx設定。

  第一步:登入tipask背景,seo設定,開啟僞靜态

  第二步:在Nginx的配置檔案nginx.conf 中,加入以下代碼實作rewrite。若開啟所有規則,則添加如下代碼:

tipask安裝在web的根目錄下的情況

tipask不在web的根目錄下的情況

  修改以上下語句中的 /tipask 為你的Tipask目錄位址即可

第三步:重新開機nginx,完畢

這個是apache下的rewrite規則

  建立.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 ^(.*)/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

繼續閱讀