Home >Backend Development >PHP Problem >How to configure apache pseudo-static?

How to configure apache pseudo-static?

青灯夜游
青灯夜游Original
2019-10-15 17:00:435629browse

How to configure apache pseudo-static?

伪静态是把动态网页的请求方式伪装成静态网页。那么想要使用伪静态技术,需要进行apache伪静态配置。

Apache的伪静态配置

1、网站根目录下需要有 .htaccess 文件,没有则自己创建一个,内容如下:

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

如果你的apache是fastcgi模式下,则需要修改

RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]

替换成

RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]

2、在apache的配置文件httpd.conf中查找 : LoadModule rewrite_module modules/mod_rewrite.so  将前面的#去掉,假如没有这段内容,则需要手动加上

3、在apache的配置文件httpd.conf中查找所有的 AllowOverride None,将 None 都替换成 All;保存文件,并重启apache服务。

The above is the detailed content of How to configure apache pseudo-static?. For more information, please follow other related articles on the PHP Chinese website!

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