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

[eluser]shanecavaliere[/eluser]
I've been looking around and trying different methods, but I can't seem to get it to work. Can anybody please let me know what I'm doing wrong?

My .htaccess file is in my site's root (as is my CI installation). I got this from the CI wiki:
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    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>

And I also changed my system/application/config/config.php so that the 'index_page' line says:
Code:
$config['index_page'] = '';

But it's still not working - I still need to include /index.php/ in the URL for it to work properly. What am I missing? Thanks in advance for any help!
#2

[eluser]shanecavaliere[/eluser]
Edit: Thought I figured it out, but I didn't... Still not working.
#3

[eluser]Tom Glover[/eluser]
Thanks for posting your solution this will help other people with the same issue.

EDIT: Maybe not then! Smile Welcome to the Forums! Smile
#4

[eluser]shanecavaliere[/eluser]
Thanks Smile Still working on it... I'll definitely post a solution when I find one.
#5

[eluser]louis w[/eluser]
Here is my htaccess. Maybe try something simpler like this before blocking certain folders, etc.


Code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ "index.php/$1" [L]
#6

[eluser]Sean Murphy[/eluser]
What is an example URL you're trying?

Also, turning on the mod_rewrite log can be very helpful in shorting these issues out. Just don't leave it on all the time, it slows down processing.

Code:
RewriteLog /Applications/MAMP/logs/mod_rewrite_log
RewriteLogLevel 8
#7

[eluser]louis w[/eluser]
I did not even know ModRewrite could log. Where do you put that? I tried placing it in my .htaccess and it a server 500. Apache logs says "RewriteLog not allowed here"
#8

[eluser]shanecavaliere[/eluser]
I'm trying http://example.com/index.php/blog/, but I want it to be http://example.com/blog/ instead. (I'm going through the documentation tutorials).
#9

[eluser]louis w[/eluser]
Did you try my htaccess?

Do you get a CI 404, or apache 404 page?

Does your blog controller have an index or _remap method?
#10

[eluser]Sean Murphy[/eluser]
[quote author="louis w" date="1212625377"]I did not even know ModRewrite could log. Where do you put that? I tried placing it in my .htaccess and it a server 500. Apache logs says "RewriteLog not allowed here"[/quote]

It's a recent discovery for me too :-) You put it in the server or vhost config. http://httpd.apache.org/docs/2.0/mod/mod...rewritelog




Theme © iAndrew 2016 - Forum software by © MyBB