Welcome Guest, Not a member yet? Register   Sign In
Problem removing 'index.php' with .htaccess
#21

[eluser]louis w[/eluser]
What about changing the last part to:

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

[eluser]shanecavaliere[/eluser]
That just shows me the welcome page again... But! I just tried changing it to:
Code:
RewriteRule     ^(.*)/$    index.php/$1 [L]
And it seems to work! Thanks a ton for all your help louis, I really appreciate it!

I do have one more quick question, though: When I go to 'http://example.com/blog/index/' it works fine, but 'http://example.com/blog/index' (with no trailing slash) gives me a 404 error. However, when I include the 'index.php' in the URI ('http://example.com/index.php/blog/index') it doesn't seem to matter if I leave off the trailing slash. Is that normal? It's not a big deal, but I just thought I'd ask.
#23

[eluser]louis w[/eluser]
Wow, that is very strange it would work with that and not with what i had.

This should make it work with/without a slash...

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

[eluser]shanecavaliere[/eluser]
Adding the question mark just makes the whole thing not work... I'm not too worried about it, though. Thanks!
#25

[eluser]louis w[/eluser]
Wow, thats a weird one. Glad we got it kinda working Smile
#26

[eluser]extra_rice[/eluser]
same stuff here... followed whatever you have going on here... reached the point where i got it *kinda* working... shane is right that the question mark just makes the whole thing not work... :-)
#27

[eluser]louis w[/eluser]
Your right, I realized afterwards the ? would only be for specifying a folder by name, not wild card.

E.g. ^home/?$

This would match "home" as well as "home/"

What do you mean by "kinda" working?
#28

[eluser]extra_rice[/eluser]
this is my .htaccess file... after hours of tweaking, pitchers of kool-aid, and bags of pan de sal with cheese i've finally solved this problem... put this in your root directory and in your code igniter's system directory... not sure about the second condition if it's necessary but currently my setup works perfectly... even without the forward slash... but im too tired and bloated to even try to find out exactly if it is indeed necessary...


Code:
<IfModule mod_rewrite.c>
    Options     +FollowSymLinks
    RewriteEngine On
    RewriteBase /

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule>
#29

[eluser]shanecavaliere[/eluser]
Ah, beautiful Smile

Nice work, extra_rice
#30

[eluser]mashary[/eluser]
i still get the problem with this

my path
document root on apache is
Code:
/var/www/html/

web code / CI code
Code:
/var/www/html/stokpb/admin

.httaccess
Code:
<IfModule mod_rewrite.c>
RewriteEngine on
ErrorDocument 404 /notfound
RewriteCond $1 !^(index\.php|images|js|css|robots\.txt)
RewriteRule ^(.*)$ /stokpb/admin/index.php/$1 [L]
</IfModule>

I run this in another server work but not mine




Theme © iAndrew 2016 - Forum software by © MyBB