Many friends may be the space is the virtual host, they do not have the authority to manage Apache httpd.conf files, naturally it is not likely to write static rules on this, we can let the host to open support. htaccess method so that you can write yourself.
First configure the server startup rewrite module
Open the Apache configuration file httpd.conf.
Remove the # #loadmodule Rewrite_module modules/mod_rewrite front.
Restart Apache after saving
Write rewrite rules
For example, the code in test.php is
<?php
$id =$_get["id"];
echo $id;
? >
The function is to accept the ID parameter in the URL and display it on the page.
First create a new document with Notepad (if not, and then save it as. htaccess, write the following code in the EditPlus)
. <ifmodule mod_rewrite.c>
. Rewriteengine on
. Rewritebase/
. Rewriterule ^t_ (. *). html$ test.php?id=$1 [L]
.</ifmodule>
For a specific explanation, you can view the Apache manual. Download apache2.2 Manual
Line 4th ^t_ (. *). html$ describes the URL address you entered, test.php?id=$1 the address it actually wants to access
For example, when you enter in a browser (assuming that your test.php and. htaccess files are in the MyTest folder of your server) localhost/mytest/t_1.html will output 1 in the browser.
If entered as localhost/mytest/t_sophp.html, the browser output sophp
The first address is actually accessed by localhost/mytest/test.php?id=1
The second actual access is localhost/mytest/test.php?id=sophp
After you have overridden the rule, it is successful to change the URL link in your Web page that was used to pass parameters to your modified rule style.
If the space you buy is supported by rewriting, just upload the. htaccess file to the root directory.