Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ilopx/yii2-basic-htaccess
File htaccess for yii2 basic
https://github.com/ilopx/yii2-basic-htaccess
htaccess php yii yii2-basic
Last synced: 4 months ago
JSON representation
File htaccess for yii2 basic
- Host: GitHub
- URL: https://github.com/ilopx/yii2-basic-htaccess
- Owner: ilopX
- Created: 2015-01-24T21:52:31.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-08-24T13:59:30.000Z (over 9 years ago)
- Last Synced: 2024-10-10T21:41:55.516Z (4 months ago)
- Topics: htaccess, php, yii, yii2-basic
- Language: PHP
- Homepage:
- Size: 288 KB
- Stars: 72
- Watchers: 8
- Forks: 31
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#Yii2 basic htaccess
![Demo](https://github.com/ilopX/yii2-basic-htaccess/blob/master/example.png)
## Video Demo
[![Video Demo](http://img.youtube.com/vi/0sxqNaznhlc/0.jpg)](http://www.youtube.com/watch?v=0sxqNaznhlc)## a. Automatic setting [index.php](https://cdn.rawgit.com/ilopX/yii2-basic-htaccess/master/index.php)
This method created .htaccess files automatically and clear self.+ Download file [index.php](https://cdn.rawgit.com/ilopX/yii2-basic-htaccess/master/index.php) or composer require ilopx/yii2-basic-htaccess
+ Put to root yii2 application
+ Start http://{your_yii2_webapp}
+ Follow [step 3 in Manual setting](#3-step)## b. Manual setting
### 1. step
#### create file {root}/.htaccess:
```Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/.*
RewriteRule ^(.*)$ web/$1 [L]RewriteCond %{REQUEST_URI} !^/web/
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ web/index.php
```### 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:
```php
'request' => [
'baseUrl' => '',
],
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'' => 'site/index',
''=>'site/',
],
],
```