Home > Backend Development > PHP Tutorial > Turn on PHP pseudo-static, turn on PHP pseudo-static_PHP tutorial

Turn on PHP pseudo-static, turn on PHP pseudo-static_PHP tutorial

WBOY
Release: 2016-07-12 09:02:10
Original
805 people have browsed it

Enable PHP pseudo-static, enable PHP pseudo-static

1. Check whether Apache supports mod_rewrite
View the environment configuration through the phpinfo() function provided by php, and use Ctrl F Find "Loaded Modules", which lists all modules that
apache2handler has enabled. If "mod_rewrite" is included, it is already supported and no further settings are required.


If "mod_rewrite" is not enabled, open the httpd.conf file
under your apache installation directory "/apache/conf/" and use Ctrl F to find "LoadModule rewrite_module" ”, just delete the “#” sign in front.


If it is not found, go to the "LoadModule" area, add "LoadModule rewrite_module modules/mod_rewrite.so" in the last line (required to be an exclusive line), and then restart the apache server.

2. Configure virtual host in httpd.conf
# Virtual hosts Enable virtual host
Include conf/extra/httpd-vhosts.conf

3. In the httpd_vhosts.conf file, configure the corresponding options. Detailed explanation

DocumentRoot "C:/myenv/apache/htdocs/static3"
ServerName www. hsp.com

#Deny from All 403 error message
Allow from All
#If the file directory is outside the apache directory , comment out optinos, it cannot be listed.
options Indexes
#The following means that you can read the .htaccess file, or you can configure it directly in the virtual host.
Allowoverride All
RewriteEngine On
RewriteRule news-id(d).html$ error.php?id=$1
#You can set multiple rewrite rules here
#RewriteRule news-id.html$ error.php
< /Directory>

4. Write .htaccess rewrite rules in the corresponding directory
Example:

RewriteEngine On
RewriteRule news-id(d).html$ show.php?id=$1
#You can set multiple rewrite rules here
#RewriteRule news-id.html$ error .php


If it can be created directly under Linux,
If it is under Windows platform, use Notepad to create a file, such as abc.txt, and then save it
Just .htaccess file

5. Rewrite rules can also be configured directly in the section of the virtual host configuration.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1086507.htmlTechArticleEnable PHP pseudo-static, enable PHP pseudo-static 1. Check whether Apache supports mod_rewrite through phpinfo() provided by php Function to view the environment configuration, use Ctrl F to find Loaded Modules, where the column...
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