子目錄偽靜態可以讓我們不帶參數并顯示為目錄或html了,這樣有利于搜索引擎對網站的抓取了,下面我們來看一些例子.
網站訪問目錄為http://show.abc.com/,但是wordpress是裝在他下面的manage目錄中的,所以訪問到的首頁也該是http://show.abc.com/manage/
而wordpress默認訪問文章的URL是http://show.abc.com/manage/?p=12 的形式,需要做偽靜態使文章訪問形式為http://show.abc.com/manage/12
在nginx中配置如下:
- server {
- listen 80;
- server_name show.Vevb.com;
- access_log logs/access_show.abc.com.log;
- error_log logs/error_show.abc.com.log;
- index index.html index.php;
- location / {
- root /web/html/show;
- }
- location /manage/ {
- try_files $uri $uri/ /manage/index.php;
- }
- location /manage/wp-content {
- alias /web/html/show/manage/wp-content;
- }
- location /manage/wp-includes {
- alias /web/html/show/manage/wp-includes;
- }
- location /manage/wp-admin {
- alias /web/html/show/manage/wp-admin;
- }
- location ~ /.php$ {
- root /web/html/show;
- fastcgi_pass 127.0.0.1:9001;
- fastcgi_param SCRIPT_FILENAME /web/html/show$fastcgi_script_name;
- include fastcgi_params;
- }
- }
|
新聞熱點
疑難解答
圖片精選