Welcome Guest, Not a member yet? Register   Sign In
RewriteRule fails when index.php is in sub-directory
#1

[eluser]tarsusc81[/eluser]
I'm using the mod_rewrite rule to remove index.php from my URLs like so:

Code:
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

I'm now trying to move my entire CodeIgniter site to an existing web site for testing purposes only. To leave the existing site undisturbed, I want all CodeIgniter files to sit in a sub-directory of the site called "codeigniter." So in other words, my root CodeIgniter directory is at http://www.mysite.org/codeigniter/.

This should be perfectly possible as long as I adjust baseurl and all other relevant config settings (and I have). If fact, it should be one of CodeIgniter's great strengths.

But the one part I'm having trouble with is the rewrite rule. This rule in .htaccess in my site's root folder (not /codeigniter) should do what I need:

Code:
RewriteRule ^codeigniter/(.*)$ codeigniter/index.php/$1 [L]

That should rewrite a url like http://www.mysite.org/codeigniter/articles to http://www.mysite.org/codeigniter/index.php/articles. But I'm having all kinds of unexpected problems.

The rule causes an internal server error. If I remove the "/$1" at the end like this there is no error:

Code:
RewriteRule ^codeigniter/(.*)$ codeigniter/index.php [L]

Or if I keep the "/$1" but remove the sub-directory there is no error:

Code:
RewriteRule ^codeigniter/(.*)$ index.php/$1 [L]

But both together cause the error. (I must admit, I don't fully understand the URL scheme of index.php/someinfo in the first place; that was completely new to me when I got into CodeIgniter.)

Can another pair of eyes see what I'm doing wrong here?


Messages In This Thread
RewriteRule fails when index.php is in sub-directory - by El Forum - 12-09-2009, 09:42 AM
RewriteRule fails when index.php is in sub-directory - by El Forum - 12-09-2009, 10:00 AM
RewriteRule fails when index.php is in sub-directory - by El Forum - 12-09-2009, 10:09 AM



Theme © iAndrew 2016 - Forum software by © MyBB