The YII module binds a second-level domain name. The YII module binds a second-level domain name. The yii second-level domain name YII module binds a second-level domain name through the following steps: first set in the configuration file: urlManagerarray (urlForma YII module to bind a second-level domain name, yii second-level domain name
The YII module performs the following steps to bind a second-level domain name:
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.jb51.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.jb51.net' => array ('/blog', 'urlsuffix '=> ", 'casesensitive' => false ), 'http: // test.jb51.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.jb51.net/comment-1.html
Local server:
I. It is not enough to set up in YII configuration. you also need to resolve the test.jb51.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.jb51.net test.jb51.net
2. you also need to add:
NameVirtualHost *:80
ServerAdmin kane@jb51.netDocumentRoot E:/wamp/www/k1029ServerName test.jb51.netErrorLog logs/test.jb51.net-error_logCustomLog logs/test.jb51.net-access_log common
To bind multiple second-level domain names, you only need to add them again.
Second-level domain name binding
You can consult with your host suppliers. some hosts do not support binding sub-domain names, and the other is to check whether the settings in your program are correct! For these two reasons!
Normally, you can fulfill your requirements! Hope to help you with your questions. if you have any questions, please consult HI online. the it club will answer your questions sincerely!
Wu Fudong [authoritative expert]
How to configure a second-level domain name in the yii Framework
You can do this.
To bind a second-level domain name to the policyii module, perform the following steps: first, set 'urlmanager' to array ('urlforma...