Virtual host and pseudo-static configuration in apache

Source: Internet
Author: User
Tags php tutorial

Find the conf/httpd. conf file in the apache installation root directory, and open the file with a line at the bottom.

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

Check whether the line include conf/extra/httpd-vhosts.conf is commented out. If commented out, cancel the comment.

Open the conf/extra/httpd-vhosts.conf file and create a new virtual machine in the file

For example, to bind a domain name to

<Virtualhost *: 80>
Documentroot "/home/" // full path of the website
Servername // domain name to be bound

Directoryindex index.html // The homepage file opened by default.


Apache pseudo-static settings

1. Open the configuration file httpd. conf of apache.

2. Remove the # loadmodule rewrite_module modules/mod_rewrite before #.

3. Add the following in httpd. conf:

<Ifmodule mod_rewrite.c>
Rewriteengine on
# Rewritecond % {env: script_url }(? : Index | dispbbs00000000-0-900000000.html
Rewriterule ^ (.*? (? : Index | dispbbs00000000-(-0-942500000000.html $1. php Tutorial? _ Is_apache_rewrite = 1 & __ rewrite_arg = $2

4. To map asp post URLs to php posts, add the following between <ifmodule mod_rewrite.c> and </ifmodule> in Step 3:

Rewritemap tolowercase int: tolower
Rewritecond % {query_string }(? : Boardid | page | id | replyid | star | skin) = d + [nc]
Rewriterule ^ (.*(? : Index | dispbbs). asp $ 1.php? $ {Tolowercase: % {query_string }}&__ is_apache_rewrite = 1

5. Save httpd. conf and restart apache.

Depending on different services and installations, conf/httpd under apache. conf will be different. Therefore, many new website builders on the internet fail to set their own sites in a successful way. Next, I will first describe the correct setting method, and then explain the cause of the failure.

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: 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.