• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

apache+codeigniter 通过.htcaccess做动态二级域名解析_php技巧

php 搞代码 3年前 (2022-01-26) 34次浏览 已收录 0个评论
 <BR>AuthName "yousite Website Coming Soon..." //如果你想给你的网站加个权限访问 <BR>AuthType Basic <BR>AuthUserFile D:/xxx/.htpasswd #如果你想设置密码访问 如何生成.htpasswd可以访问 http://www.htaccesstools.com/htpasswd-generator/ <BR>#AuthGroupFile /dev/null <BR>require valid-user <br><br> <BR>RewriteEngine On <BR>RewriteBase / <br><br>#Removes access to the system folder by users. <BR>#Additionally this will allow you to create a System.php controller, <BR>#previously this would not have been possible. <BR>#'system' can be replaced if you have renamed your system folder. <BR>RewriteCond %{REQUEST_URI} ^system.* <BR>RewriteRule ^(.*)$ /index.php?/$1 [L] <br><br>#When your application folder isn't in the system folder <BR>#This snippet prevents user access to the application folder <BR>#Submitted by: Fabdrol <BR>#Rename 'application' to your applications folder name. <BR>RewriteCond %{REQUEST_URI} ^application.* <BR>RewriteRule ^(.*)$ /index.php?/$1 [L] <br><br><BR> <BR># Redirect to boutique (with any trailing path) <BR>RewriteCond %{HTTP_HOST} !^www. [NC] <BR>RewriteCond %{HTTP_HOST} ^([^.]+).yousite.com(.*)$ [NC] <BR>RewriteRule ^(.*)$ http://www.yousite.com/boutique/$1$2 [P,L] <BR> <br><br> <BR># Redirect to boutique (with any trailing path) <BR>RewriteCond %{HTTP_HOST} !^www. [NC] <BR>RewriteCond %{HTTP_HOST} ^([^.]+).yousite.com(.*)$ [NC] <BR>RewriteRule ^(.*)$ http://www.yousite.com/boutique/%1/$1 [R=301,L] <BR> <br><br>## Otherwise, force www; <BR>RewriteCond %{HTT<mark>@本文来源gaodaimacom搞#代%码@网-</mark><strong>搞代gaodaima码</strong>P_HOST} ^yousite.com$ [NC] <BR>RewriteRule ^(.*)$ http://www.yousite.com/$1 [R=301,L] <br><br>#Checks to see if the user is attempting to access a valid file, <BR>#such as an image or css document, if this isn't true it sends the <BR>#request to index.php <BR>RewriteCond %{REQUEST_FILENAME} !-f <BR>RewriteCond %{REQUEST_FILENAME} !-d <BR>RewriteRule ^(.*)$ index.php/$1 [L] <BR> <br><br> <BR># If we don't have mod_rewrite installed, all 404's <BR># can be sent to index.php, and everything works as normal. <BR># Submitted by: ElliotHaughin <br><br>ErrorDocument 404 /index.php <BR> <BR>


出处:cnblogs 微博:@草根小胡


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:apache+codeigniter 通过.htcaccess做动态二级域名解析_php技巧
喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址