오픈 소스 문답 Tipak 의사 정적 apache 와 nginx 설정
8912 단어 Tipak 의사 정적
STEP 1: tipak 백 스테이지 로그 인, seo 설정, 위 정적 오픈
두 번 째 단계: Nginx 프로필 nginx. conf 에 다음 코드 를 추가 하여 rewrite 를 실현 합 니 다.모든 규칙 을 열 면 다음 코드 를 추가 합 니 다:
tipak 가 웹 루트 디 렉 터 리 에 설 치 된 경우
if ($request_filename ~* (.*)\.html){
rewrite ^/(.*)$ /index.php?$1;
}
tipak 가 웹 루트 디 렉 터 리 에 없 는 경우
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 이 파일 을 만 들 고 tipak 루트 디 렉 터 리 에 놓 으 면 됩 니 다. 그리고 배경 에서 위 정적 을 엽 니 다!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