Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to have one project on one domain and use two frameworks (Yii and Yii2)?

Tags:

php

yii

yii2

My site was written on Yii framework (v1) and now I would like to start to rewrite it using Yii2. My plan is do it step by step starting from simple, solitary parts.

But I can't understand how can I combine two frameworks in background of my visitors, is it possible at all ? Assuming that I have php 5.4 (or if need 5.5) on server, ONE domain name with no subdomains.

Eg: site has modular structure (it's real so) and have modules: news and articles. I will rewrite news on Yii2 and articles stay using Yii,

mysite.com/news and mysite.com/articles - should show the same as before and visitors shouldn't notice that news uses another framework (url should be the same as before)

Question is: How can I reach it if it's possible ? Is anybody have practical solution or did it in real project ?

like image 272
LIAL Avatar asked Jun 15 '15 06:06

LIAL


1 Answers

If you know how to config url rewrite in nginx or apache , yes, you can .

  • Nginx: http://nginx.org/en/docs/http/ngx_http_rewrite_module.html
  • Apache: http://httpd.apache.org/docs/current/mod/mod_rewrite.html

The essence is match url with regex, base on the difference of url load different index.php of different framework.

like image 117
Link Avatar answered Oct 01 '22 22:10

Link