FreeBSD7.0編譯安裝nginx+php+mysql
2024-06-01
更新時間:2024-06-01 00:08:08作者:佚名
1.在需要使用.htaccess文件的目錄下新建一個.htaccess文件
這個.htaccess文件一般discuz、dedecms等系統(tǒng)都自帶
# .htaccess rewrite rule
rewrite ^(.*)/archiver/((fid|tid)-[w-]+.html)$ $1/archiver/index.php?$2 last;
rewrite ^(.*)/forum-([0-9]+)-([0-9]+).html$ $1/forumdisplay.php?fid=$2&page=$3 last;
rewrite ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+).html$ $1/viewthread.php?tid=$2&extra=page%3D$4&page=$3 last;
rewrite ^(.*)/profile-(username|uid)-(.+).html$ $1/viewpro.php?$2=$3 last;
rewrite ^(.*)/space-(username|uid)-(.+).html$ $1/space.php?$2=$3 last;
rewrite ^(.*)/tag-(.+).html$ $1/tag.php?name=$2 last;
# end .htaccess rewrite rule
2.然后修改nginx.conf,在需要添加偽靜態(tài)的虛擬主機的server{}中引入.htaccess文件
server{
include xxxx/.htaccess; ##(把這個改成你.htaccess文件的具體位置)
}
重啟nginx.conf即可。