Solutions for pseudo-static PHP programs!

Source: Internet
Author: User
Solutions for pseudo-static PHP programs !! I am talking about solving the problem in the PHP program, not modifying the APACHE server !!, The program must have an entry file and then process the url. the. htaccess file PHPcodeRewriteEngineOnRewriteBase/RewriteRule solves the pseudo-static PHP program !!
I am talking about the solution in the PHP program, instead of modifying the APACHE server,

Solution !!

------ Solution --------------------
The program must have an entry file and then process the url.
------ Solution --------------------
. Htaccess file

PHP code
RewriteEngine OnRewriteBase/RewriteRule ^ ([\ d000000000000.html $ news. php? Id = $1 # What is news. php? Change id = 123 to 123.html.
------ Solution --------------------
If you have to do this in a PHP program, you can only use 404 to redirect.

First, you must allow these static addresses to access the 404 page.

Then, use PHP on the 404 page to obtain the URL address and output different content based on the address.
------ Solution --------------------
PATH_INFO
------ Solution --------------------
Discussion

PATH_INFO

------ Solution --------------------
Currently, apache supports pathinfo by default.
------ Solution --------------------
Http://blog.csdn.net/aendo/article/details/5467417
This is ASP, PHP does not need to do so, there is a better way
------ Solution --------------------
Positive solution on the second floor. The PHP method does not know what the landlord wants.
------ Solution --------------------
You must enter the url. this is the first step. parsing the url is the second step and processing is the third step.
Step 1 enter abc.html
The second step is to convert html to php.
You can skip to 404

If you really don't want to change the url
After passing JS to realize it, abc.html is used.
You can use ajax to secretly run php and bring the data in it.

------ Solution --------------------
Pseudo-static ~
------ Solution --------------------
Pseudo-static ~
------ Solution --------------------
It's not easy to learn !!!

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.