㈠ 關於php網站遇到的 .htaccess 問題
打開.htaccess,找到
Options +FollowSymLinks
RewriteEngine On
RewriteBase /shop/
看對應的目錄是不是對,如是根目錄,修改成
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
如目錄在二級,比如test這個目錄上,修改成
Options +FollowSymLinks
RewriteEngine On
RewriteBase /test/
㈡ php如何修改.htaccess文件
windows是不提供直接命名這種文件名的,我的xp就不行,win7行不行我沒測試過,但是可以通過下載壓縮包後解壓縮可以創建,
網上有提供.htaccess這個文件的壓縮包的,你隨便搜就能找到。
解壓縮後就可以對這個文件進行編輯和修改了
㈢ php-rewrite如何開啟
htaccess文件是Apache伺服器中的一個配置文件,它負責相關目錄下的網頁配置。
啟用.htaccess,需要修改httpd.conf,啟用AllowOverride,並可以用AllowOverride限制特定命令的使用。
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
改為
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
你上面那個例子的實現:
RewriteEngine On
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule (.*)/(.*)/(.*) index.php?control=$1&model=$2¶=$3 [PT]
把這些保存為.htaccess文件放在網站的根目錄就行了
㈣ phpStudy開啟Apache重寫模塊(開啟偽靜態)
pbootcms開啟偽靜態後地址欄不再包含 index.php,開啟步驟如下:
Apache環境:
1、開啟Apache重寫模塊,具體請網路;
2、修改程序config/config.php文件 url_type=2
3、在站點目錄建立.htaccess文件(默認已有),內容如下:
㈤ 如何利用.htaccess文件對PHP網站或文件進行偽靜態處理
一、檢查伺服器是否支持偽靜態處理:
必須要空間支持 Rewrite 以及對站點目錄中有 .htaccess 的文件解析,才有效.找到apache安裝目錄下的httpd.cof文件,去掉LoadMole rewrite_mole moles/mod_rewrite.so前面的#(大概在154行,我的默認是開啟)
二、在httpd.cof中查找以下部分:
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
改為:
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
如果沒有,手動添加。(PS:LZ試過,在最近的新版本的Apache上即使沒有這個,.htaccess照樣生效。但是不同伺服器及版本的原因,建議加上)
三、重啟apache伺服器,添加.htaccess文件
建立.htaccess文件的方式:
1、保存文件的時候將文檔保存成名為「***.txt」,再將其上傳到伺服器上,之後直接使用FTP軟體來重命名為「.htaccess」。(適合windows)
2、保存文件的時候選擇文件—>另存為,保存類型選所有文件,然後文件名輸入.htaccess 。(適合windows)
3、直接在你的Unix或Linux虛擬主機上建立。
4、先用記事本編寫好,隨便保存為一個什麼文件名,然後打開「命令提示符」(CMD),然後再用重命名命令(rename),例如:rename c:\htaccess.txt .htaccess
㈥ 如何利用.htaccess文件對PHP網站或文件進行偽靜態處理
利用.htaccess文件對PHP網站進行偽靜態處理要考慮兩點:
一.伺服器支持偽靜態,比如Apache要開啟mod_rewrite模塊支持
二.利用.htaccess完成偽靜態需要根據不同的網站系統進行不同的設置,以下是一些常見系統的.htaccess設定:
01.wordpress:
# BEGIN WordPress
<IfMole mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfMole>
02.Phpwind
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
RewriteRule ^(.*)simple/([a-z0-9\_]+\.html)$ $1/simple/index.php?$2
03.Discuz
RewriteEngine On
# Rewrite 系統規則請勿修改
RewriteRule ^archiver/((fid|tid)-[0-9]+\.html)$ archiver/index.php?$1
RewriteRule ^forum-([0-9]+)-([0-9]+)\.html$ forumdisplay.php?fid=$1&page=$2
RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ viewthread.php?tid=$1&extra=page\%3D$3&page=$2
RewriteRule ^space-(username|uid)-(.+)\.html$ space.php?$1=$2
RewriteRule ^tag-(.+)\.html$ tag.php?name=$1
04.ecshop
RewriteEngine On
# direct one-word access
RewriteRule ^index\.html$ index\.php [L]
RewriteRule ^category$ index\.php [L]
# access any object by its numeric identifier
RewriteRule ^feed-c([0-9]+)\.xml$ feed\.php\?cat=$1 [L]
RewriteRule ^feed-b([0-9]+)\.xml$ feed\.php\?brand=$1 [L]
RewriteRule ^feed\.xml$ feed\.php [L]
RewriteRule ^category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ category\.php\?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5&page=$6&sort=$7&order=$8 [QSA,L]
RewriteRule ^category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)(.*)\.html$ category\.php\?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5 [QSA,L]
RewriteRule ^category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ category\.php\?id=$1&brand=$2&page=$3&sort=$4&order=$5 [QSA,L]
RewriteRule ^category-([0-9]+)-b([0-9]+)-([0-9]+)(.*)\.html$ category\.php\?id=$1&brand=$2&page=$3 [QSA,L]
RewriteRule ^category-([0-9]+)-b([0-9]+)(.*)\.html$ category\.php\?id=$1&brand=$2 [QSA,L]
RewriteRule ^category-([0-9]+)(.*)\.html$ category\.php\?id=$1 [QSA,L]
RewriteRule ^goods-([0-9]+)(.*)\.html$ goods\.php\?id=$1 [QSA,L]
RewriteRule ^article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ article_cat\.php\?id=$1&page=$2&sort=$3&order=$4 [QSA,L]
RewriteRule ^article_cat-([0-9]+)-([0-9]+)(.*)\.html$ article_cat\.php\?id=$1&page=$2 [QSA,L]
RewriteRule ^article_cat-([0-9]+)(.*)\.html$ article_cat\.php\?id=$1 [QSA,L]
RewriteRule ^article-([0-9]+)(.*)\.html$ article\.php\?id=$1 [QSA,L]
RewriteRule ^brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)\.html brand\.php\?id=$1&cat=$2&page=$3&sort=$4&order=$5 [QSA,L]
RewriteRule ^brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*)\.html brand\.php\?id=$1&cat=$2&page=$3 [QSA,L]
RewriteRule ^brand-([0-9]+)-c([0-9]+)(.*)\.html brand\.php\?id=$1&cat=$2 [QSA,L]
RewriteRule ^brand-([0-9]+)(.*)\.html brand\.php\?id=$1 [QSA,L]
RewriteRule ^tag-(.*)\.html search\.php\?keywords=$1 [QSA,L]
RewriteRule ^snatch-([0-9]+)\.html$ snatch\.php\?id=$1 [QSA,L]
RewriteRule ^group_buy-([0-9]+)\.html$ group_buy\.php\?act=view&id=$1 [QSA,L]
RewriteRule ^auction-([0-9]+)\.html$ auction\.php\?act=view&id=$1 [QSA,L]
05.phpcms
RewriteEngine On
RewriteRule ^(.*)content-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/index\.php\?m=content&c=index&a=show&catid=$2&id=
$3&page=$4
RewriteRule ^(.*)show-([0-9]+)-([0-9]+)-([0-9]+).html$ $1/index\.php\?m=content&c=index&a=show&catid=$2&id=
$3&page=$4
RewriteRule ^(.*)list-([0-9]+)-([0-9]+).html$ $1/index\.php\?m=content&c=index&a=lists&catid=$2&page=$3
㈦ 我的空間是php的,.htaccess不怎麼這么設置,我這么通過阿里巴巴網站的
.htaccess把這個文件傳到虛擬主機裡面就可以了,我用息絡的虛擬主機就是這樣設置的
㈧ htaccess php
rewriteEngine off是關閉路由重寫功能
deny from all是許可權設置的語句
㈨ 如何利用.htaccess文件對PHP網站或文件進行偽靜態處理
一、檢查伺服器是否支持偽靜態處理:
必須要空間支持 Rewrite 以及對站點目錄中有 .htaccess
的文件解析,才有效.找到apache安裝目錄下的httpd.cof文件,去掉LoadMole rewrite_mole
moles/mod_rewrite.so前面的#(大概在154行,我的默認是開啟)
二、在httpd.cof中查找以下部分:
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
改為:
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
如果沒有,手動添加。(PS:LZ試過,在最近的新版本的Apache上即使沒有這個,.htaccess照樣生效。但是不同伺服器及版本的原因,建議加上)
三、重啟apache伺服器,添加.htaccess文件
建立.htaccess文件的方式:
1、保存文件的時候將文檔保存成名為「***.txt」,再將其上傳到伺服器上,之後直接使用FTP軟體來重命名為「.htaccess」。(適合windows)
2、保存文件的時候選擇文件—>另存為,保存類型選所有文件,然後文件名輸入.htaccess 。(適合windows)
3、直接在你的Unix或Linux虛擬主機上建立。
4、先用記事本編寫好,隨便保存為一個什麼文件名,然後打開「命令提示符」(CMD),然後再用重命名命令(rename),例如:rename c:\htaccess.txt .htaccess
請注意: .htaccess必須,保存為ANSI 格式,以ASCII模式上傳,最好將其許可權設置為644。
一般我們將.htaccess文件放置在網站的根目錄,控制所在目錄及所有子目錄,當然也可以放在網站的任何一個子目錄下,但如果放置在子目錄中,子目錄中的指令會覆蓋更高級目錄或者主伺服器配置文件中的指令。
在博客收錄集(http://www.ido321.com/1112.html)為例,本地.htaccess文件如下:
#rewriteengine為重寫引擎開關on為開啟off為關閉
RewriteEngine On
RewriteRule ^index\.html$ index.php
RewriteRule ^webmore\.html$ webmore.php
以index.html代替index.php webmore.html代替webmore.php。
.htaccess支持正則表達式,例如:
原始 news/detail.php?id=2 偽靜態 news/detail_2.html
RewriteRule ^news/detail_([0-9]{1,})\.html$ news/detail.php?id=$1
㈩ shopnc怎麼開啟偽靜態 shopnc開啟偽靜態的方法
1.先下載isapi
rewrite插件,安裝,然後我們把根目錄下面的htaccess.txt那麼修改成.htaccess即可。
2.找到網站目錄\data\config下面找到config.ini.php進行開啟偽靜態。
打開config.ini.php(記住用文本或者DW),不要用記事本打開、否則會出錯
找到$config['url_model']
=
false;
把
false
修改為:true
這樣偽靜態就開啟了!!
轉自【B5教程網】:http://www.bcty365.com/content-145-2492-1.html