2

I'm running Code Igniter and my .htaccess was:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?$1 [L]
    RedirectMatch 404 /\\.svn(/.*|$)
</IfModule>

Then I realized that no $_GET variable was getting through.

I followed some instructions to create the .htaccess to use together with Code Igniter, and replaced the index.php?$1 with index.php/$1. This works on a linux machine, but on the Windows it doesn't. I'm sure it is a server configuration, but I don't know which one.

Assuming that I access

http://localhost/directory/this_is_query/string_parameters?with_some=additional_ones

The $_SERVER['QUERY_STRING'] value with index.php?$1 on .htaccess is:

string(31) "this_is_query/string_parameters" 

And with index.php/$1:

No input file specified. 

On the Linux machine I have:

string(31) "with_some=additional_ones"

As response with index.php/$1.

Any thoughts?


I'm debugging the $_SERVER['QUERY_STRING'] variable on the FIRST line of index.php, with NO interaction with Code Igniter whatsoever.

Yes, I do have mod_rewrite.

THIS IS NOT THE SAME AS Codeigniter no input file specified error

I saw that question before asking this one. And I'm still with the issue.

I've added new information.

3
  • Try $_SERVER['PATH_INFO'] when using index.php/$1. Commented Oct 11, 2012 at 21:29
  • With index.php/$1 I also get 'No input file specified' on PATH_INFO. Commented Oct 11, 2012 at 21:30
  • Yes, it is similar to that one, but not the same. I need to keep both my linux and windows machines with the same .htaccess. And on linux, the /$1 works perfectly. And also, I'm testing this without Code Igniter, so it's not a CI configuration issue. Commented Oct 11, 2012 at 21:38

2 Answers 2

1

I think you're missing the QSA option to append the query string to the end:

RewriteRule \.svn/ - [F,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L,QSA]

And to keep query params organized, I would suggest setting a parameter name, if allowed with CodeIgniter:

RewriteRule ^(.*)$ index.php?page=$1 [L,QSA]
Sign up to request clarification or add additional context in comments.

1 Comment

Not an option to use with Code Igniter. It needs the /$1
1

Use RewriteRule ^(.*)$ index.php/?$1 [L]

1 Comment

I need to use index.php/$1, as this should be the same on both Linux and Windows. Can you please help me to reopen this question? Cheers :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.