Home >Backend Development >PHP Tutorial >关于URL重写的问题

关于URL重写的问题

WBOY
WBOYOriginal
2016-06-23 13:28:17820browse

虚拟主机  win2003系统,我已经在服务器上配置了ISAPI模式,在httpd.conf里面写了一些伪静态规则,但是没效果,我问了下服务器提供商,他们说要在程序后台开启url重写模式,这个是要在程序里读取httpd.conf文件吗?


回复讨论(解决方案)

把下面的内容保存为.htaccess文件放到入口文件的同级目录下,比如要重写index.php,那么在.htaccess文件里写入

<IfModule mod_rewrite.c>    RewriteEngine on    RewriteCond %{REQUEST_FILENAME} !-d    RewriteCond %{REQUEST_FILENAME} !-f    RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]</IfModule>


还要重启Apache

把下面的内容保存为.htaccess文件放到入口文件的同级目录下,比如要重写index.php,那么在.htaccess文件里写入

<IfModule mod_rewrite.c>    RewriteEngine on    RewriteCond %{REQUEST_FILENAME} !-d    RewriteCond %{REQUEST_FILENAME} !-f    RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]</IfModule>


还要重启Apache



win2003系统  iis服务
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:判断一个数组Next article:PECL轻松安装PHP扩展