1.detects if Apache supports mod_rewrite to view the environment configuration via PHP's Phpinfo () function via CTRL+F Find "Loaded Modules", which lists all the modules that Apache2handler has been turned on, if it includes "mod_rewrite", it is already supported and no longer required to continue setting. If "Mod_rewrite" is not turned on, open the directory for your Apache installation directory "/apache/conf/"under the httpd.conf file, via CTRL+f find "LoadModule rewrite_module", the previous "#"number to delete. if not found, go to the "LoadModule" area and add "LoadModule rewrite_module modules" on the last line./mod_rewrite.So "(required exclusive line), then restart the Apache server. 2. In httpd.Configuring a virtual host in Conf#virtual hosts enable web hostingIncludeConf/extra/httpd-vhosts.conf3.httpd_vhosts.conf file, configure the appropriate options.Detailed explanation<virtualhost *:80>DocumentRoot"C:/MYENV/APACHE/HTDOCS/STATIC3"ServerName www. HSP.com<directory "C:/MYENV/APACHE/HTDOCS/STATIC3" >#Deny from all 403 error prompt allow from all#If the file directory is outside the Apache directory, comment out Optinos, not the list.Options +Indexes#The following indicates that you can read the. htaccess file, or you can configure it directly in the virtual host .allowoverride allrewriteengine Onrewriterule News-id (\d+). html$ error.php?id=$1#you can set multiple overriding rules here.#rewriterule news-id.html$ error.php</Directory> </virtualhost>4. Write in the appropriate directory.htaccess Rewrite rule example:<ifmodule rewrite_module>Rewriteengine Onrewriterule News-id (\d+). html$ show.php?id=$1#you can set multiple overriding rules here.#rewriterule news-id.html$ error.php</IfModule>If you can create it directly under Linux,If you are using Notepad to create a file under the Windows platform, such as Abc.txt,then save as.htaccess files can be5. Rewrite the rules, or you can configure the <Directory> segment of the virtual host directly.
Turn on pseudo-static for PHP