定制 ilopx/yii2-basic-htaccess 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ilopx/yii2-basic-htaccess

最新稳定版本:1.0

Composer 安装命令:

composer require ilopx/yii2-basic-htaccess

包简介

Set web directory in webroot

README 文档

README

#Yii2 basic htaccess

Demo

Video Demo

Video Demo

a. Automatic setting index.php

This method created .htaccess files automatically and clear self.

b. Manual setting

1. step

create file {root}/.htaccess:

<IfModule mod_rewrite.c>
    Options +FollowSymlinks
    RewriteEngine On
</IfModule>
 
<IfModule mod_rewrite.c>
    RewriteCond %{REQUEST_URI} ^/.*
    RewriteRule ^(.*)$ web/$1 [L]

    RewriteCond %{REQUEST_URI} !^/web/
    RewriteCond %{REQUEST_FILENAME} !-f [OR]
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^.*$ web/index.php
</IfModule> 

2. step

create file {root}/web/.htaccess:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php

3. step

update file {root}/config/web.php:

'request' => [
    'baseUrl' => '',
],
'urlManager' => [
    'enablePrettyUrl' => true,
    'showScriptName' => false,
    'rules' => [
        '' => 'site/index',
        '<action>'=>'site/<action>',
    ],
],

统计信息

  • 总下载量: 325
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 70
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 70
  • Watchers: 8
  • Forks: 31
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-08-22