Welcome Guest, Not a member yet? Register   Sign In
My .htaccess works, but not with CI
#1

[eluser]dejavu[/eluser]
This is a strange one. Using index.php in the URL works, e.g http://dev.seeyou.com/index.php/staff (this is not the actual site)

My .htaccess works perfectly on an XAMPP install:
Code:
RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|test\.php)
RewriteRule ^(.*)$ /index.php/$1 [L]
#RewriteRule ^(.*)$ /test.php/$1 [L]

To test if .htaccess was working, I created test.php. In test.php, I'm simply var_dump-ing $_SERVER,
Code:
<pre>&lt;?php
var_dump($_SERVER);
and it works fine - see below.

But if I comment out test.php and uncomment index.php, it keeps taking me to the "Welcome to CodeIgniter" page. Any idea why this would be working on one server and not another?

Thanks!

(Var dump of $_SERVER)
Code:
array(37) {
  ["DOCUMENT_ROOT"]=>
  string(28) "/home/seeyou/public_html/dev"
  ["GATEWAY_INTERFACE"]=>
  string(7) "CGI/1.1"
  ["HTTP_ACCEPT"]=>
  string(63) "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
  ["HTTP_ACCEPT_CHARSET"]=>
  string(30) "ISO-8859-1,utf-8;q=0.7,*;q=0.7"
  ["HTTP_ACCEPT_ENCODING"]=>
  string(12) "gzip,deflate"
  ["HTTP_ACCEPT_LANGUAGE"]=>
  string(14) "en-us,en;q=0.5"
  ["HTTP_CACHE_CONTROL"]=>
  string(9) "max-age=0"
  ["HTTP_CONNECTION"]=>
  string(10) "keep-alive"
  ["HTTP_HOST"]=>
  string(20) "dev.seeyou.com"
  ["HTTP_KEEP_ALIVE"]=>
  string(3) "300"
  ["HTTP_USER_AGENT"]=>
  string(113) "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.15) Gecko/2009101601 Firefox/3.0.15 (.NET CLR 3.5.30729)"
  ["PATH"]=>
  string(4) "/bin"
  ["QUERY_STRING"]=>
  string(0) ""
  ["REDIRECT_STATUS"]=>
  string(3) "200"
  ["REDIRECT_UNIQUE_ID"]=>
  string(24) "SvtWBEPhvSwAADQoa0wAAAAP"
  ["REDIRECT_URL"]=>
  string(7) "/staff/"
  ["REMOTE_ADDR"]=>
  string(13) "204.16.229.61"
  ["REMOTE_PORT"]=>
  string(5) "20211"
  ["REQUEST_METHOD"]=>
  string(3) "GET"
  ["REQUEST_URI"]=>
  string(7) "/staff/"
  ["SCRIPT_FILENAME"]=>
  string(37) "/home/seeyou/public_html/dev/test.php"
  ["SCRIPT_NAME"]=>
  string(7) "/staff/"
  ["SERVER_ADDR"]=>
  string(13) "67.225.189.44"
  ["SERVER_ADMIN"]=>
  string(30) "[email protected]"
  ["SERVER_NAME"]=>
  string(20) "dev.seeyou.com"
  ["SERVER_PORT"]=>
  string(2) "80"
  ["SERVER_PROTOCOL"]=>
  string(8) "HTTP/1.1"
  ["SERVER_SIGNATURE"]=>
  string(173) "
Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.7a mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at dev.seeyou.com Port 80

"
  ["SERVER_SOFTWARE"]=>
  string(114) "Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.7a mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635"
  ["UNIQUE_ID"]=>
  string(24) "SvtWBEPhvSwAADQoa0wAAAAP"
  ["ORIG_PATH_INFO"]=>
  string(7) "/staff/"
  ["ORIG_PATH_TRANSLATED"]=>
  string(37) "/home/seeyou/public_html/dev/test.php"
  ["ORIG_SCRIPT_NAME"]=>
  string(9) "/test.php"
  ["PHP_SELF"]=>
  string(7) "/staff/"
  ["REQUEST_TIME"]=>
  int(1257985540)
  ["argv"]=>
  array(0) {
  }
  ["argc"]=>
  int(0)
}
#2

[eluser]Ben Edmunds[/eluser]
What kind of server is this not working on?

Did you change your config.php settings properly?
#3

[eluser]dejavu[/eluser]
CentOS.

I think my config is correct because CI works fine with index.php, just acts clueless without it. Like it can't see the PHP_SELF string or whatever is used to find out where to call the controller.
#4

[eluser]Ben Edmunds[/eluser]
Make sure

Code:
$config['index_page'] = "";
#5

[eluser]wiredesignz[/eluser]
[quote author="dejavu" date="1258009941"]... clueless ... Like it can't see the ... whatever is used to find out where to call the controller.[/quote]

Look at your $_SERVER dump and set $config['uri_protocol'] appropriately.
#6

[eluser]dejavu[/eluser]
Thanks buddy! That wasn't the problem, but the next config option down fixed it:

Code:
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
| URI string.  The default setting of "AUTO" works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'AUTO'      Default - auto detects
| 'PATH_INFO'   Uses the PATH_INFO
| 'QUERY_STRING'  Uses the QUERY_STRING
| 'REQUEST_URI'   Uses the REQUEST_URI
| 'ORIG_PATH_INFO'  Uses the ORIG_PATH_INFO
|
*/
$config['uri_protocol'] = "REQUEST_URI";

It was using QUERY_STRING, which as you can see above is the one URI/path value that's returning as empty.




Theme © iAndrew 2016 - Forum software by © MyBB