phpiis伪静态配置
‘壹’ iis怎么实现thinkphp中的伪静态
如果你的服务器环境支持ISAPI_Rewrite的话,可以配置httpd.ini文件,添加下面的内容:
RewriteRule (.*)$ /index\.php\?s=$1 [I]
在IIS的高版本下面可以配置web.Config,在中基档间添加rewrite节点:
<rewrite>
<rules>
<rule name="OrgPage" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^(.*)$" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />衡锋运
<add input="{REQUEST_FILENAME}"咐梁 matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:1}" />
</rule>
</rules>
</rewrite>
‘贰’ IIS 服务器下的PHP伪静态要怎么弄啊
1.检测Apache是否支持mod_rewrite
通过php提供的phpinfo()函数查看环境配置,通过Ctrl+F查找到“Loaded Moles”,其中列出了所有
apache2handler已经开启的模块,如果里面包括“mod_rewrite”,则已经支持,不再需要继续设置。
如果没有开启“mod_rewrite”,则打开目录 您的apache安装目录“/apache/conf/” 下的 httpd.conf 文
件,通过Ctrl+F查找到“LoadMole rewrite_mole”,将前面的”#”号删除即可。
如果没有查找到,则到“LoadMole” 区域,在最后一行加入“LoadMole rewrite_mole moles/mod_rewrite.so”(必选独占一行),然后重启apache服务器即可。
2.在httpd.conf中配置虚拟主机
# Virtual hosts 启用虚拟主机
Include conf/extra/httpd-vhosts.conf
3.httpd_vhosts.conf文件中,配置相应的选项.详细讲解
DocumentRoot "C:/myenv/apache/htdocs/static3"
ServerName www.hsp.com
myenv/apache/htdocs/static3">
#Deny from All 403错误提示
Allow from All
#如果文件目录在apache目录外面,注释掉optinos 则,不能列表.
options +Indexes
#下面这个表示可以去读取 .htaccess文件,也可以直接在虚拟主机中配置.
Allowoverride All
RewriteEngine On
RewriteRule news-id(\d+).html$ error.php?id=$1
#这里可以设置多个重写的规则
#RewriteRule news-id.html$ error.php
4.在相应的目录下编写.htaccess 重写规则
例子:
RewriteEngine On
RewriteRule news-id(\d+).html$ show.php?id=$1
#这里可以设置多个重写的规则
#RewriteRule news-id.html$ error.php
如果在linux下可以直接创建,
如果是在windows平台下,用记事本创建一个文件,比如abc.txt,然后另存
为 .htaccess文件即可
5.重写规则,也可以直接在配置虚拟主机的段配置.
‘叁’ iis php伪静态怎么设置
thinkphp :把以下代码保存成web.config文件,放到网站根目录内即可。
<?xml version="1.0" encoding="UTF-8"?><configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="ThinkPHP_NiPaiYi" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer></configuration>
‘肆’ iis怎么实现thinkphp中的伪静态
1:安装,ISAPI_Rewrite3
2:网站根目录下,.htaccess
至于规则,族贺则根据你的具体要求来写
例如
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
请将上面正则表达式,保存为亏穗颤.htaccesss文件,并放到thinkphp项目入口文件同级目录下。并且修改销败数据库配置(config.php)文件使网站支持url重写功能,加入代码:define(‘URL_REWRITE’,2);
‘伍’ php怎么配置伪静态
第一步:找到apache的配置文件httpd.conf 按照下面配置
第三步:
在网站根目录直接建一个.htaccess文件 这里面是写伪静态规则的。就想php的正则表达式
但语法和php正则略有不同,你可以直接到网上搜索伪静态正则。这个文件可以用记事本创建直接保存文件名为.htaccess 记住文件名字第一个字符是英文的点。。祝你好运,不会call我