Apache Configure virtual host
Modify httpd.conf
Enable virtual hosts
#Include conf/extra/ httpd-vhosts.conf (Find this line, remove the front #)
Comment documentroot "D:/program files/apache/apache2.2/htdocs"
Comment
#<directory/>
# Options followsymlinks
# allowoverride None
# order Deny,allow
# allow from all
#</directory>
Configuration/con f/extra/httpd-vhosts.conf
The
code is as follows |
copy code |
<virtualhost 192.168.1.2:80> # First Virtual host ServerAdmin xxx@gmail.com # Admin mailbox ServerName xxx.xx.com # Bound domain name documentroot "D:/www/wordpress" # Site Directory Serveralias xxx.xxx.cn #网站别名, you can not set the ErrorLog logs/ Dummy-host.localhost-error.log " #日志 customlog" logs/ Dummy-host.localhost-access.log "Common </virtualhost> |
Apache open rewrite mode
Open Apache configuration file: Apache installation directory/conf/httpd.conf.
Search rewrite: "#LoadModule rewrite_module modules/mod_rewrite.so" will be found to remove the "#" in front of it.
Search allowoverride: Change "allowoverride none" to "allowoverride all". Note: This allowoverride is within the <directory "~/htdocs" > tag. The "~" for Apache installation directory
joins the. htaccess file in the entry file directory, (if the. htaccess file is not created, you can write the rewrite rule in the next file on the Web).
The code is as follows |
Copy Code |
<ifmodule mod_rewrite.c> Rewriteengine on Rewritecond%{request_filename}!-d Rewritecond%{request_filename}!-f Rewriterule ^ (. *) $ index.php/$1 [qsa,pt,l] </IfModule> |
The entry file for my PHP project is index.php
Finally reboot the Apache server