.htaccess裡面
RewriteEngine onRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^(.*)$ index.php?s=$1 [QSA,PT,L]
能訪問首頁,但是內頁的頁面都沒辦法訪問了,用
index.php?a=guest是能訪問的
/guest就不行了,求幫忙,'URL_MODEL' => 2
回複討論(解決方案)
因為nginx和apache的偽靜態寫法不一樣呢。 nginx是不支援.hta檔案的呢
因為nginx和apache的偽靜態寫法不一樣呢。 nginx是不支援.hta檔案的呢
那應該怎麼配置呢?網上我看了好多方法都只說配nginx.conf,照著網站那種改過也不行
server { listen 80; server_name www.phpno.com; root /home/www/www_phpno_com/admin_wwwroot; access_log off; error_page 404 /404.html; location /404.html { root /home/www/www_phpno_com/admin_wwwroot; } location /{ index index.html index.htm index.php; if (-e $request_filename) { break; } if (!-e $request_filename) { rewrite ^/(.*)$ /index.php/$1 last; break; } } location ~ .+\.php($|/) { root /home/www/www_phpno_com/admin_wwwroot; fastcgi_index index.php; fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /home/www/www_phpno_com/admin_wwwroot/$fastcgi_script_name; # fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html/$fastcgi_script_name; include fastcgi_params; } }自己對比改一下
照著弄了一下也不行呢
location ~ \.php$ { fastcgi_split_path_info^(.+\.php)(.*)$; includefastcgi_params; fastcgi_paramSCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_paramSERVER_NAME $http_host; fastcgi_paramPATH_INFO $fastcgi_path_info; fastcgi_paramPATH_TRANSLATED $document_root$fastcgi_path_info; fastcgi_passunix:/var/run/php-fpm/php-fpm.sock; fastcgi_paramSCRIPT_NAME $fastcgi_script_name; root/data/php/www; }
解決了,如果你的ThinkPHP安裝在二級目錄,Nginx的偽靜態方法設定如下,其中youdomain是所在的目錄名稱。
location /youdomain/ { if (!-e $request_filename){ rewrite ^/youdomain/(.*)$ /youdomain/index.php?s=$1 last; } }