nginx偽靜態 感謝

來源:互聯網
上載者:User
nginx偽靜態求助 感謝

Options +FollowSymLinks

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]


###########################華麗麗的分界線#################
#上面是原來htaccess中的url重寫配置(apache環境),thinkphp項目,有xx、yy、zz三個分組,xx是預設分組
#下面是我要配置的虛擬機器
##########################################################
server {
listen 80;
server_name www.aaa.com;
location / {
root E:/webroot;
index index.html;
includefastcgi_params;

rewrite ^(.*)$/index.php?$1 last;
}
error_page404 = http://www.aaa.com/error404.html;
location ~ \.php$ {
rootE:/webroot;
fastcgi_pass127.0.0.1:9000;
fastcgi_indexindex.html;
fastcgi_paramSCRIPT_FILENAME E:/webroot$fastcgi_script_name;
includefastcgi_params;
}
}



搞了一下午,無論訪問www.aaa.com/yy 還是訪問www.aaa.zz, 其實都指向了預設的xx分組
崩潰 求助 感謝

分享到:


------解決方案--------------------

#把所有來源解析到index.php
rewrite ^(.[^~]*)~(.*)$ /index.php?mod=$1&action=$2 last;

例如
http://7di.net/a~b 會解析到 http://7di.net/index.php?mod=a&action=b
------解決方案--------------------
引用:
感謝樓上 已經搞定:
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
請結貼
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.