Answer the question
In order to leave comments, you need to log in
Is it possible to make a route to a .php file in yii2?
Yes, I understand it’s not safe, but I’m integrating part of yii2 into another system, so such a route is needed.
Moreover, you need to make a route to some view file (yes, stupidly, but necessary), so that it looks something like this: /views/site/hello.php so that when you click on the link, yii2 will transfer to this file. thank.
Answer the question
In order to leave comments, you need to log in
Set up .htassets so that all requests go to web/index.php , and all requests starting with /views go to the views folder Like
this:
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
# Если запрос начинается с /views, то заменяем на /views
RewriteCond %{REQUEST_URI} ^/views
RewriteRule ^ views\/?(.*) /views/$1
# Добавляем другой запрос /web/$1
RewriteCond %{REQUEST_URI} !^/(web|views)
RewriteRule (.*) /web/$1
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question