I
I
Ivan Yakushenko2016-07-11 12:41:21
PHP
Ivan Yakushenko, 2016-07-11 12:41:21

Why doesn't .htaccess work?

I use OpenServer, installed Yii2 version Basic 2.0.8, I wanted to make URLs more "beautiful", for this I created the following htaccess in the root of Yii2:

Option +FollowSymLinks
IndexIgnore */*
RewriteEngine on

RewriteCond %{REQUEST_URI} !^/(web)
RewriteRule ^assets/(.*)$ /web/assets/%1 [L]
RewriteRule ^css/(.*)$ /web/css/%1 [L]
RewriteRule ^js/(.*)$ /web/js/%1 [L]
RewriteRule ^images/(.*)$ /web/images/%1 [L]
RewriteRule ^fonts/(.*)$ /web/fonts/%1 [L]
RewriteRule (.*) /web/%1

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

In the web folder is the following:
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . index.php

I also uncommented the urlManager in the ./config/web.php file and added 'baseUrl' => '' to the request component.
After all this, when trying to access the site using any path, the following error occurs:
Server error!

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.

If you think this is a server error, please contact the webmaster.

Error 500

testsite
Apache

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question