see thing is that I need to separate 2 different projects (old and new(yii) one) inside 1 domain name, so if I go to site.com/index.php?action=someaction then it shows me old proejct info, old proj does not use SEO urls
and if I go to site.com/posts/ for example then yii app is executed and I see posts page.
Thats’ why I exctracted new project under yii folder so it will not interfere with old project because both of them uses index.php as start file.
I need to make them work together on same domain, sounds weird but I have to do it
Now I have an another idea how to make them work, is it possible that yii use some other script name as start script? for example if I create start.php and use it instead of index.php for yii project ? if it’s possible then I don’t need a subfolder for yii project and I can put it on same directory level as old project. Old proj will still use index.php as start script and yii proj will use start.php then
Yes this is possible, you would need to use .htaccess (if you are on apache, this doesn’t apply for iis) and mod_rewrite to control the paths of different requests.
Essentially mod_rewrite is part of apache (placed in .htaccess) that changes the route of a url. So for example with the standard yii .htaccess you have:
RewriteRule . index.php [L,QSA]
This says route all requests to index.php, so when you visit site.com/posts, apache "rewrites" it to site.com/index.php and yii can pull the "posts" part to handle the requests
.
You can play around with htaccess to get your desired result, but from what you are saying it seems like your .htaccess would look something like:
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 . start.php
so you would have index.php and start.php, one mapping to your old controller and one to the new one. Since you are accessing the old one via /index.php you don’t need anything special because the line
jiaming, this will not help me as I need to keep index.php as default entry script for old project version in same time I need start.php as entry script for new project version which placed in same folder.
crasx , it works ! thanks that is exactly what I need !