D
D
des1roer2015-03-31 19:52:20
Yii
des1roer, 2015-03-31 19:52:20

How to properly work with Yii htaccess and htpasswd?

The first time a window popped up, but the verification failed. Now I can not repeat the focus.
Explain on the fingers pliz.

AuthName "Restricted Area" 
AuthType Basic 
AuthUserFile /home/mysite/.htpasswd 
AuthGroupFile /dev/null 
require valid-user

/home/mysite/ - in case of localhost it is /localhost/mysite/ ?
and in the case of the server /mysite.ru/mysite/ ?
Where to put htpasswd ? In a category below or above?
Is /protected enough for yii?
What about the server?
And what to do with the native htaccess? Is it easy to add?
AddDefaultCharset utf-8

Options +FollowSymLinks 
IndexIgnore */* 
RewriteEngine on

# if a directory or a file exists, use it directly 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php 
RewriteRule . index.php

php_value post_max_size 10M
php_value upload_max_filesize 10M
php_value max_execution_time 200
php_value max_input_time 200

and in general I had this -
yii (framework)
mysite (in the same folder) - here
AddDefaultCharset utf-8

Options +FollowSymLinks 
IndexIgnore */* 
RewriteEngine on

# if a directory or a file exists, use it directly 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php 
RewriteRule . index.php

php_value post_max_size 10M
php_value upload_max_filesize 10M
php_value max_execution_time 200
php_value max_input_time 200

### force www
   RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
   RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
   RewriteBase /

in the mysite/protected/.htaccess folder
deny from all
Explain on your fingers what is responsible for what and how to use it with and without yii.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Makarov, 2015-04-01
@des1roer

Only applies to Yii

RewriteEngine on

# if a directory or a file exists, use it directly 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php 
RewriteRule . index.php

The rest is apache.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question