Enable PHP pseudo-static and PHP pseudo-static. Enable PHP pseudo-static and PHP pseudo-static. check whether Apache supports mod_rewrite. check the Environment configuration through the phpinfo () function provided by php, and find LoadedModules through Ctrl + F. The column enables the pseudo-static PHP and the PHP pseudo-static
1. check whether Apache supports mod_rewrite.
Use the phpinfo () function provided by php to view the environment configuration, and use Ctrl + F to find "Loaded Modules", which lists all
Apache2handler has enabled the module. if it contains "mod_rewrite", it is supported and does not need to be set any more.
If "mod_rewrite" is not enabled, open the httpd. conf file in the directory "/apache/conf /".
To find the "LoadModule rewrite_module" through Ctrl + F, and delete the "#" in front of the module.
If not found, add "LoadModule rewrite_module modules/mod_rewrite.so" to the last row in the "LoadModule" area, and then restart the apache server.
2. configure the virtual host in httpd. conf
# Enable Virtual host in Virtual hosts
Include conf/extra/httpd-vhosts.conf
3. configure the corresponding options in the httpd_vhosts.conf file.
DocumentRoot "C:/myenv/apache/htdocs/static3"
ServerName www.hsp.com
# Deny from All 403 error prompt
Allow from All
# If the file directory is outside the apache Directory and optinos is commented out, the list cannot be displayed.
Options + Indexes
# The following indicates that the. htaccess file can be read or configured directly on the VM.
Allowoverride All
RewriteEngine On
RewriteRule news-id (\ d00000000.html $ error. php? Id = $1
# Multiple rewrite rules can be set here
# RewriteRule news-id.html $ error. php
4. write the. htaccess rewrite rule in the corresponding directory
Example:
RewriteEngine On
RewriteRule news-id (\ d1_0000.html $ show. php? Id = $1
# Multiple rewrite rules can be set here
# RewriteRule news-id.html $ error. php
If you can directly create a file in linux,
In Windows, create a file with a notebook, such as abc.txt, and save
Is the. htaccess file.
5. rewrite the rules. you can also directly configure Segment configuration.
Tip 1. check whether Apache supports mod_rewrite. use the phpinfo () function provided by php to view the environment configuration. use Ctrl + F to find Loaded Modules, and the column...