Codeigniter uses. htcaccess for dynamic second-level domain name resolution

Source: Internet
Author: User
Tags codeigniter

 

Today, the PHP version of the server is upgraded to 5.4.4. Then, a previous project is switched to Apache, and the dynamic second-level switch is switched to. htcaccess for sharing.

Authname "yousite website coming soon... "// if you want to give your website a permission to access authtype basic authuserfile D:/XXX /. htpasswd # how to generate a password for access. htpasswd can access the 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 will allow you to create a system. PHP controller, # pre Viously this wocould 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: 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/42511042 [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 ^ (. *) $ response [R = 301, l] </ifmodule> # Otherwise, force WWW; 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 # 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>

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.