首頁 >後端開發 >php教程 >apache+codeigniter 透過.htcaccess做動態二級域名解析

apache+codeigniter 透過.htcaccess做動態二級域名解析

黄舟
黄舟原創
2016-12-17 09:30:211609瀏覽

. 程式碼如下:


AuthName "yousite Website Coming Soon..." //如果你想為你的網站加個權限訪問 
AuthType Basic 
AuthUserFile D:/xxx/.htpasswd #如果你想設定密碼存取如何產生.htpasswd可以存取http://www.htaccesstools.com/htpasswd-generator/ 
#AuthGroupFile /dev/null 
require valid-user 

#Additionally this will allow you to create a System.php controller, 
#previously this would not have been possible. 
#'system' canly this would not have been possible. 
#'system' can be reaved if RewriteCond %{REQUEST_URI} ^system.* 
RewriteRule ^(.*)$ /index.php?/$1 [L] 

#When your application folder isn't in the system folder application folder 
#Submitted by: Fabdrol 
#Rename 'application' to your applications folder name. 
RewriteCond %{REQUEST_URI} ^application.* 
RewriteCond %{REQUEST_URI} ^application.* 
RewriteCond %{REQUEST_URI} ^application.* 

 
# Redirect to boutique (with any trailing path) 
RewriteCond %{HTTP_HOST} !^www. [NC] 
RewriteCond %{TP_HOST] .*)$ [NC] 
RewriteRule ^(.*)$ http://www.yousite.com/boutique/$1$2 [P,L] 
 

 

Redirect to boutique (with any trailing path) 
RewriteCond %{HTTP_HOST} !^www. [NC] 
RewriteCond %{HTTP_HOST} ^([^.]+).yousite.com(.*)$ [NC. ^(.*)$ http://www.yousite.com/boutique/%1/$1 [R=301,L] 
 

## Otherwise, force www; 
RewriteCond %{HTTP_HOST} ^RewriteCond %{HTTP_HOST} ^ yousite.com$ [NC] 
RewriteRule ^(.*)$ http://www.yousite.com/$1 [R=301,L] 

#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the 
#request to index.php 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENIL} !-f * ) $ as normal. 
# Submitted by: ElliotHaughin 

ErrorDocument 404 /index.php 
 

 以上就是apache+codeigniter 透過使用更多網域的動態內容,第二級動態文章解析出在中文上加分! (www.php.cn)! 

 




陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn