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

[eluser]Underware[/eluser]
I can see the frontpage (application), but how come all the links are error 404 (except for the real websites links?
I've used the original .htaccess with xampp. Needless to say mod_rewrite on.
#12

[eluser]Pascal Kriete[/eluser]
You'll need to be a tad more specific. Maybe give us a sample of what doesn't work.

Are you using relative links, or base_url()?
Do the urls work with index.php in them?
#13

[eluser]Underware[/eluser]
Inparo:

Ok...i got it now, if I type in the address bar localhost/ci_sample/index.php/video, it's working. But all the links (left navigation) from ci_sample are w/o index.php. I suppose this got to do with .htaccess right?

Just a question: beside using .htaccess, is there another way of not using index.php ??

http://localhost/ci_sample/index.php/video <-- this not preferable
http://localhost/ci_sample/video <-- most web application w/o modifying .htaccess
#14

[eluser]Underware[/eluser]
inparo:

I've used ur .htaccess
RewriteEngine on
RewriteCond $1 !^(index\.php|system|img|css|js|video_files|robots\.txt|favicon\.ico) [NC]
RewriteRule ^(.*)$ /ci_sample/index.php/$1 [L]

All the links are fine now. I assumed that DA's .htaccess are only for the webroot installation.
But, as I've said be4, if i developed on my computer (which is always webroot subfolder), if i copy it to my hosting (webroot), I should always have 2 .htaccess. So how can i get rid of that /index.php/ without .htaccess ?

Regards,
#15

[eluser]Pascal Kriete[/eluser]
There is no other way, that I know of, to remove the index.php on an apache webserver. Lighttpd is another story.

EDIT: If everything else stays the same, you could try not specifying a path at all, such as:
Code:
RewriteRule ^(.*)$ index.php/$1 [L]
That way you're just using a relative path, which doesn't change when switching servers.
#16

[eluser]Bramme[/eluser]
[quote author="inparo" date="1203738216"]@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[/quote]
Digging this topic back up. I suggest this .htaccess should replace the current one in the user guide. Because that one messed up my css. calls to /css/styles.css got directed to index.php, resulting in a 404 error, so no stylesheet. Also this way, if it doesn't exist, and it's not a controller or function in your CI app, you get a 404 anyway.
#17

[eluser]Pascal Kriete[/eluser]
I agree that it's easier to use, as you don't really need to understand what's going on. The other one is safer though, because it's a little like saying 'Deny From All' for all folders that you exclude. And you get a 404 page that fits your site.

Maybe a clarification that any files or folder you want to exclude have to be added to the RewriteCond should be added to the userguide.
#18

[eluser]Bramme[/eluser]
true, because I've got a few folders that need to be accessed without CI calling index.php, I just don't know how to do it (and I'm a little too lazy to google it).

Maybe while we're at it: add a line too that directs the standard 404 error to the CI 404 page. Cuz they're not linked with the original .htaccess either.




Theme © iAndrew 2016 - Forum software by © MyBB