-
- $id=$_GET["id"];
- echo $id;
- ?>
Copy the code
First in the apache file
Open the Apache configuration file httpd.conf and find the following: #LoadModule rewrite_module modules/mod_rewrite.so
Enable rewrite and click on the "#" in front of it
2. Overload Allowoverride
Find the apache configuration file and find the following:
-
-
- Options FollowSymLinks
- AllowOverride None
Copy code
Change AllowOverride None to AllowOverride All
Temporarily learned about three types of url redefinition in htaccess
-
- RewriteEngine On
- #RewriteBase / (If the file is in the root directory, it does not need to be defined)
- #RewriteRule ^t_(.*).html$ test.php?id=$1 [ NC](Open test.php to t_id.html such as t_2.html page output id=2)
- RewriteRule ^([0-9]+)$ test.php?id=$1 [NC](Enter the id directly such as localhost/ test/2 page output id=2)
- RewriteRule ^index.html$ index.php [NC] (Directly enter index.html to open the index.php page)
Copy code
|