㈠ 关于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