[eluser]Dahak-II[/eluser]
I develop locally on a Windows XP box running Apache/2.2.14 (Win32) PHP/5.2.6.
My htaccess file reads as:
Code:
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript application/javascript text/css
AddOutputFilterByType DEFLATE application/javascript
RewriteEngine on
RewriteCond $1 !^(index\.php|rss-feed\.php|robots\.txt|phpinfo\.php|favicon\.ico|apple-touch-icon\.png|index_header\.php|index_navjavaphp\.php|index_archivenavjavaphp\.php|images|css|CSS|js|tmp|_Counters|Collections)
RewriteRule ^(.*)$ /index.php?/$1 [L]
The RewriteCond line just lists all of the files/directories excluded from he rewrite.
This is the
same htaccess file used in the production environment.
I have the site configured to remove the index.php from the URI, so you also need:
Code:
$config['index_page'] = "";
My code is configured to auto-detect if it's running under Windows (dev) or Linux (production) with:
Code:
if (stristr(PHP_OS, 'WIN')) {
$config['uri_protocol'] = 'REQUEST_URI';
} else {
$config['uri_protocol'] = 'AUTO';
}
Any other environment-specific code can be checked the same way.
For instance, I assume that if the OS is Windows, it's my local dev box and configure logging threshold and other values accordingly. If the OS is
not Windows, I assume it's the production environment.
Full Disclosure:
At the moment, my old site has ported over to CI2.0 and runs on my Windows dev box fine, but only routes to the default controller/index in my production Linux environment.