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

How to configure apache pseudo-static?

青灯夜游
Release: 2023-02-26 18:58:02
Original
5635 people have browsed it

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>
Copy after login

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

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

替换成

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

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template