Enable PHP pseudo-static and PHP pseudo-static _ PHP Tutorial

Source: Internet
Author: User
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...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.