Method for binding second-level domain names in the YII module _ php instance

Source: Internet
Author: User
This article mainly introduces how to bind a second-level domain name in the YII module. If you need it, refer to the following steps to bind a second-level domain name in the YII module:

First, set in the configuration file:

'Urlmanager' => array ('urlformat' => 'path', 'showscriptname' => false, // be sure not to enclose 'urlsuffix '=> '.html' in quotation marks for 'false ', 'rules' => array ('HTTP: // test.php.net' => array ('/blog', 'urlsuffix '=> ", 'casesensitive' => false ),),

Blog is a module. If there is still a second controller in the blog module (comment is used as an example here), you need to write one more rule, as shown below:

'Urlmanager' => array ('urlformat' => 'path', 'showscriptname' => false, // be sure not to enclose 'urlsuffix '=> '.html' in quotation marks for 'false ', 'rules' => array ('HTTP: // test.php.net' => array ('/blog', 'urlsuffix' => ", 'casesensitive '=> false ), 'http: // test.php.net/comment-
 
  
'=> Array ('/blog/comment/', 'urlsuffix' => '.html ', 'casesensitive' => false ),),
 

If you want to access a comment under the blog the URL will be: http://test.php.net/comment-1.html

Local Server:

I. It is not enough to set the test.php.net second-level domain name in the YII configuration. You also need to resolve the test.php.net second-level domain name to the program server in the DNS server. You can add it at the end of hosts.

127.0.0.1    www.php.net   test.php.net

2. You also need to add:

NameVirtualHost *:80
 
  ServerAdmin kane@php.netDocumentRoot E:/wamp/www/k1029ServerName test.php.netErrorLog logs/test.php.net-error_logCustomLog logs/test.php.net-access_log common
 

To bind multiple second-level domain names, you only need to add them again.

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: info-contact@alibabacloud.com 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.