V
V
vitaly_742019-10-16 15:47:39
Yii
vitaly_74, 2019-10-16 15:47:39

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

1 answer(s)
M
Maxim, 2019-10-19
@vitaly_74

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

But the question is not clear at all. Need to write more

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question