Answer the question
In order to leave comments, you need to log in
Why in yii2 when urlManager enablePrettyUrl is enabled, the page display is not correct?
Good day! I installed clean yii2 2.0.12 and the start page is displayed like this:
This is after I registered the Apache config (The site is on the local OpenServer server):
#-----------------------------------------------#
# Начало блока конфигурации HTTP хоста
#-----------------------------------------------#
<VirtualHost *:%httpport%>
DocumentRoot "%hostdir%/web"
ServerName "%host%"
ServerAlias "%host%" %aliases%
ScriptAlias /cgi-bin/ "%hostdir%/cgi-bin/"
</VirtualHost>
#-----------------------------------------------#
# Конец блока конфигурации HTTP хоста
#-----------------------------------------------#
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
],
],
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
Internal Server Error solved the issue by simply putting htaccess in the wrong place. Moved htaccess to web folder and links started working
Answer the question
In order to leave comments, you need to log in
It is easiest to change the structure to shared. Move everything from the web to the root of the public folder, and throw everything else into the yii folder, for example, one level higher than the public folder and correct the paths in index.php
Here is a video with the structure for shared hosting:
https://youtu.be/hg5t5F3HdM4?list= PLOm4dl-NavgyBnt...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question