2017 © Pedro Peláez
 

library yii2-basic-htaccess

Set web directory in webroot

image

ilopx/yii2-basic-htaccess

Set web directory in webroot

  • Monday, August 24, 2015
  • by ilopX
  • Repository
  • 9 Watchers
  • 63 Stars
  • 206 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 32 Forks
  • 0 Open issues
  • 2 Versions
  • 2 % Grown

The README.md

Yii2 basic htaccess

Demo, (*1)

Video Demo

Video Demo, (*2)

a. Automatic setting index.php

This method created .htaccess files automatically and clear self., (*3)

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>',
    ],
],

The Versions

24/08 2015

dev-master

9999999-dev

Set web directory in webroot

  Sources   Download

MIT

by Avatar ilopX

23/08 2015

1.0

1.0.0.0

Set web directory in webroot

  Sources   Download

MIT

by Avatar ilopX