apache中訪問不了偽靜態(tài)頁面的解決方法
1、安裝
./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --enable-ssl
這時apache已經(jīng)擁有的偽靜態(tài)功能了,稱為內建偽靜態(tài)。
2、如果安裝的時候沒有 --enable-rewrite 這個參數(shù),那么:
到“LoadModule” 區(qū)域,在最后一行加入“LoadModule rewrite_module modules/mod_rewrite.so”(必選獨占一行),然后重啟apache服務器即可。
3、讓apache服務器支持.htaccess
vim /usr/local/apache2/conf/extra/http-vhosts
Options FollowSymLinks
AllowOverride None
改為
Options FollowSymLinks
AllowOverride All
就可以了。
但是需要在網(wǎng)站文件中加入一個htaccess文件。才可以綜合支持偽靜態(tài)功能。(在網(wǎng)站文件目錄下)
vim .htaccess
RewriteEngine On
RewriteBase /
# Rewrite規(guī)則
RewriteRule ^index\.htm$ index\.php
RewriteRule ^jobs/jobs-show-([0-9]+)\.htm$ jobs/jobs-show\.php\?id=$1
RewriteRule ^company/company-show-([0-9]+)\.htm$ company/company-show\.php\?id=$1
RewriteRule ^resume/resume-show-([0-9]+)\.htm$ resume/resume-show\.php\?id=$1
RewriteRule ^news/news-list-([0-9]+)-([0-9]+)\.htm$ news/news-list\.php\?id=$1&page=$2
RewriteRule ^news/news-show-([0-9]+)\.htm$ news/news-show\.php\?id=$1
RewriteRule ^explain/explain-show-([0-9]+)\.htm$ explain/explain-show\.php\?id=$1
RewriteRule ^notice/notice-list-([0-9]+)-([0-9]+)\.htm$ notice/notice-list\.php\?id=$1&page=$2
RewriteRule ^notice/notice-show-([0-9]+)\.htm$ notice/notice-show\.php\?id=$1
偽靜態(tài)報錯:
主站好用,但是鏈接不好用。鏈接是一個靜態(tài)頁面。以.html結尾的,所以我判斷,就是為靜態(tài)頁面沒生效,所以就添加.htaccess文件即可。
相關文章
Winserver2012下mysql 5.7解壓版(zip)配置安裝教程詳解
這篇文章主要介紹了Winserver2012下mysql 5.7解壓版(zip)配置安裝教程詳解,非常不錯,具有參考借鑒價值,需要的朋友可以參考下2017-01-01mysql 加了 skip-name-resolve不能鏈接數(shù)據(jù)庫問題的解決方法
這篇文章主要介紹了mysql 加了 skip-name-resolve不能鏈接數(shù)據(jù)庫問題的解決方法,需要的朋友可以參考下2016-04-04mysql ERROR 1044 (42000): Access denied for user ''''@''loca
這篇文章主要介紹了mysql下提示ERROR 1044 (42000): Access denied for user ''@'localhost' to database,需要的朋友可以參考下2015-09-09