Apache+codeigniter through. htcaccess do dynamic two-level domain name resolution _php skills

Source: Internet
Author: User
Tags codeigniter
Copy Code code as follows:

AuthName "Yousite Website Coming Soon ..."//If you want to give your site additional access
AuthType Basic
AuthUserFile d:/xxx/.htpasswd #如果你想设置密码访问 How to build. HTPASSWD can access http://www.htaccesstools.com/htpasswd-generator/
#AuthGroupFile/dev/null
Require Valid-user

<ifmodule mod_rewrite.c>
Rewriteengine on
Rewritebase/

#Removes access to the System folder by users.
#Additionally This'll allow you to create a system.php controller,
#previously This would is not have been possible.
# ' system ' can be replaced if you have renamed your system folder.
Rewritecond%{request_uri} ^system.*
Rewriterule ^ (. *) $/index.php?/$1 [L]

#When your application folder isn ' t in the System folder
#This snippet prevents user access to the application folder
#Submitted By:fabdrol
#Rename ' application ' to your Applications folder name.
Rewritecond%{request_uri} ^application.*
Rewriterule ^ (. *) $/index.php?/$1 [L]


<ifmodule mod_proxy.c>
# Redirect to boutique (with any trailing path)
Rewritecond%{http_host}!^www. [NC]
Rewritecond%{http_host} ^ ([^.] +). yousite.com (. *) $ [NC]
Rewriterule ^ (. *) $ http://www.yousite.com/boutique/$1$2 [p,l]
</IfModule>

<ifmodule!mod_proxy.c>
# Redirect to boutique (with any trailing path)
Rewritecond%{http_host}!^www. [NC]
Rewritecond%{http_host} ^ ([^.] +). yousite.com (. *) $ [NC]
Rewriterule ^ (. *) $ http://www.yousite.com/boutique/%1/$1 [r=301,l]
</IfModule>

# # otherwise, Force www;
Rewritecond%{http_host} ^yousite.com$ [NC]
Rewriterule ^ (. *) $ http://www.yousite.com/$1 [r=301,l]

#Checks to the If the user was 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}!-d
Rewriterule ^ (. *) $ index.php/$1 [L]
</IfModule>

<ifmodule!mod_rewrite.c>
# If We don ' t have Mod_rewrite installed, all 404 ' s
# can be sent to index.php, and everything works as normal.
# submitted By:elliothaughin

ErrorDocument 404/index.php
</IfModule>

Source: Cnblogs Micro bo: @ grassroots Xiao Hu

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.