Welcome Guest, Not a member yet? Register   Sign In
Attn: Derek Allard - CI Sample .htaccess
#1

[eluser]MrBaseball34[/eluser]
Can you explain what is going on here?

I put the files for your function search sample program in a directory named
ci_sample off my webroot. But when I go to http://localhost/ci_sample, I get a

Code:
Internal Server Error:

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, admin@ci_sample.net and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Here is the .htaccess, I am thinking this is the problem because if I rename it, the app works.

Code:
RewriteEngine on
RewriteRule ^$ /index.php [L]
RewriteCond $1 !^(index\.php|img|css|js|video_files|robots\.txt|favicon\.ico)
RewriteRule ^(.*)$ /index.php/$1 [L]
#2

[eluser]Pascal Kriete[/eluser]
/puts on Derek Allard hat

Ok, a few things here - you don't need that first RewriteRule, you want your system folder to be part of the RewriteCond and you don't want a leading slash in that last rule because you're not using the webroot. So try:
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|system|img|css|js|video_files|robots\.txt|favicon\.ico) [NC]
RewriteRule ^(.*)$ /ci_sample/index.php/$1 [L]

EDIT: Just to clarify this a bit, the first line turns on url rewriting. The second line says that anything that isn't one of the things in the parenthesis gets stored to $1. And the third line takes that stored bit and appends it to ci_sample/index.php/.
#3

[eluser]MrBaseball34[/eluser]
Modifying my .htaccess like that still didn't work.

Can you explain what is going on with those commands?
#4

[eluser]Rick Jolly[/eluser]
Derek is a very busy guy. You'd get a better response by inviting anyone in the community to have a go at your problem. Collectively, we're almost as smart as Derek.

inparo - just to be clear, the $1 in the RewriteCond and in the RewriteRule references what is captured in the RewriteRule regex, no? In this case ^(.*)$.
#5

[eluser]Rick Jolly[/eluser]
MrBaseball34, make sure mod_rewrite is enabled. It isn't enabled by default with XAMPP for example. Surround inparo's example with <IfModule mod_rewrite.c></IfModule>.
#6

[eluser]Pascal Kriete[/eluser]
@Rick: Right, but since it just says "any character as often as you want" it seems confusing to go the extra step.

Another one to try would be
Code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /ci_sample/index.php/$1 [L]

Which basically says - if it doesn't exist, go to index.php
#7

[eluser]MrBaseball34[/eluser]
Well, first off, I'm such a DA because I didn't have mod_rewrite on. Second, the last mod works.
Thanks to both of you.
#8

[eluser]MrBaseball34[/eluser]
BTW, I'm using WAMP for my dev environment.
#9

[eluser]Rick Jolly[/eluser]
[quote author="MrBaseball34" date="1203739476"]Well, first off, I'm such a DA because I didn't have mod_rewrite on. Second, the last mod works.
Thanks to both of you.[/quote]
Don't worry, sometimes if feel like a total "Derek Allard" too. Or did you mean dumb a**?
#10

[eluser]MrBaseball34[/eluser]
dumb a$$ was the term I was pertaining, for sure.




Theme © iAndrew 2016 - Forum software by © MyBB