Im giving support to an already deployed php application, but the way it works is new to me, and I have no idea how it does what it does.
Basically, a php method is called using a path-like syntax to retrieve data, for example:
<?php
// .....
$json = Request("http://_server/myfolder/abc/default/mymethod?data=something");
// Now $json var has some information.
?>
The odd thing is how methods are structured. Up to folder 'myfolder' physical path exists in linux 'server', you know ".../apache/htdocs/myfolder/" but thats IT. Further than that, physical location of code is within a different folder structure where default/mymethod matches NO folders at all.
By digging deeper, I found that mymethod corresponds to the PHP method located in:
apache/htdocs/myfolder/protected/modules/abc/controllers/defaultcontroller.php
And inside defaultcontroller.php there is something like this:
<?php
// ....
Class DefaultController {
// ....
Public Function actionmymethod { // Notice the name of mymethod has 'action'
// more code
return $response;
}
}
?>
Im 100% sure that method is fired when running the Request call, but my I dont know how it is done.
My question is:
How the setup of this is done? There must be some place where you relate:
"http://_server/myfolder/abc/default/mymethod" with "actionmethod"
but where and how?
I need to make a copy of this running, so I can call my copy with something like this:
"http://_server/FOLDERCOPY/myfolder/abc/default/mymethod"
I already made a copy to the new structure, but when calling it, server cant find the new method/path :(
EDIT*** I found this in htaccess located at /myfolder/
RewriteEngine on
RewriteBase /myfolder/
# 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
I modified the copy inside /FOLDERCOPY/myfolder, but it seems is not working :(
RewriteEngine on
RewriteBase /FOLDERCOPY/myfolder/
# 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
Thanks