So i have got the next code:
ini_set("include_path" , ini_get("include_path") . ":/Library/WebServer/Documents/__CMS/:"); ini_set('display_errors', 'ON'); $base_url = '127.0.0.1'; $lib_dir = '/Library/WebServer/Documents/__CMS/'; header('Location: admin/main.php?base_url='.$base_url.'&lib_dir='.$lib_dir);
that is pretty ugly but simple, I am looking for a way to cope with multiple files in multiple location's i am somewhat acquainted with bootstraping, try not to fully be aware of "guidelinesInch.
my finish goal could be one file that parses a ini file and distributes variables, locations and the like towards the other files...all files will have to pass through this file prior to being loaded. I had been considering setting variables through the .htaccess method but i am unsure how that actually works.
any help could be great! (i am searching for some theory and finest practices here )
The easiest way I've carried this out before is by using Apache's 404 handler along with a rewrite. Essentially, you know apache (within the .htaccess) to transmit all 404's towards the index.php (or perhaps your bootstrap) and for the reason that file you are able to determine where they have to go according to the things they typed and load this content accordingly..
world wide web.mysite.com/page.html > 404! > index.php > Load data for page.html
When the data for page.html doesn't exist, then you definitely just throw your custom 404 rather.
Simple enough to setup and develop.
You could utilize mod_rewrite to link all demands for your index.php
RewriteEngine on RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php
- http://example.org/test/foo is internally rewritten to http://example.org/index.php
- Within the $_SERVER array you will still discover the information for /test/foo
Take a look a some popular frameworks. For instance Zend Framework.