• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
htaccess for PHP-CGI hosting (and use segments with query strings)

#1
[eluser]wiredesignz[/eluser]
This custom .htaccess setup allows you to use uri segments and query strings together and may fix the issue everyone seems to have running CI on PHP-CGI hosting.

The great thing is that CI allows us to use a custom defined uri protocol. (thanks Rick Ellis)

If you want to try this setup then read on.

Set your custom uri protocol in application/config.php
Code:
$config['uri_protocol'] = "APP_PATH";

//enable query strings if required.
$config['enable_query_strings'] = TRUE;

Create your .htaccess file like so
Code:
RewriteEngine On

RewriteBase /

RewriteCond %{ENV:REDIRECT_APP_PATH} !^$
RewriteRule ^(.*)$ - [E=APP_PATH:%{ENV:REDIRECT_APP_PATH}]

RewriteCond %{ENV:APP_PATH} ^$
RewriteRule ^(.*)$ - [E=APP_PATH:/$1]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L]

You should be good to go. Good luck.

Credit goes to the folks @ TinyMVC forum for this solution.


Messages In This Thread
htaccess for PHP-CGI hosting (and use segments with query strings) - by El Forum - 11-07-2008, 08:11 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.