Welcome Guest, Not a member yet? Register   Sign In
mod_rewrite, what am i doing wrong?
#1

[eluser]b2000b[/eluser]
Ive been trying at this for a few hours now and I just cant get mod_rewrite to remove the index.php from my ci project. Here is what I've done.

config.php
Code:
$config['index_page'] = '';
$config['uri_protocol']="REQUEST_URI";

.htaccess
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule>


mod_rewirte IS enabled, it it shown in: apache2handler -> Loaded Modules -> mod_rewrite, when phpinfo(); is called.

uname -a:
Code:
Linux io.b2000b.net 2.6.32-220.2.1.el6.x86_64 #1 SMP Fri Dec 23 02:21:33 CST 2011 x86_64 x86_64 x86_64 GNU/Linux

CI is located in: /var/www/html/b2k/
CI is accses as: io.b2000b.net/b2k
CI can be found on the Internet at http://b2000b.net/b2k

If anyone can help that be wonderful! I host this sever my self and have full root accsess to it. I can get this working fine with my VPS but I cant pinpoint what I've done wrong here.
#2

[eluser]Stefan Hueg[/eluser]
Try this:

Code:
RewriteBase /b2k

And also try to remove the leading slashes from your RewriteRules.
#3

[eluser]b2000b[/eluser]
Thanks, I will try this later tonight and get back to you.
#4

[eluser]ojcarga[/eluser]
I am just using this

Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /folder1/folder2/index.php?/$1 [L]

</IfModule>

I have mi CI two level high that is why I use /folder1/folder2/index.php
#5

[eluser]b2000b[/eluser]
Thanks for the repley, I'll try this one also.
#6

[eluser]InsiteFX[/eluser]
If you are using XAMPP on windows your .htaccess file will never work!
If you want to test .htaccess is working just place text in the top of it
Code:
// <IfModule mod_rewrite.c> needs to be changed to <IfModule mod_rewrite.so>

<IfModule mod_rewrite.so>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.so>
    ErrorDocument 404 /index.php
</IfModule>
#7

[eluser]ojcarga[/eluser]
@InsiteFX, it is strange cuase my .htaccess looks like this and works perfect.

Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /folder1/folder2/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 /folder1/folder2/index.php
</IfModule>


I guess I had to un-comment something inside the httpd.conf

Code:
LoadModule rewrite_module modules/mod_rewrite.so

and as you say, on windows it uses .so instead of .c ... strange, uh?
#8

[eluser]b2000b[/eluser]
InsiteFX, I am not useing XAMPP on windows, quoting myself;

Quote:uname -a:

Code:
Linux io.b2000b.net 2.6.32-220.2.1.el6.x86_64 #1 SMP Fri Dec 23 02:21:33 CST 2011 x86_64 x86_64 x86_64 GNU/Linux

Or, In other words, CentOS 6.2 2.6.32 64bit

Ojcarga, since it is Linux I have used the .c extention, and
Quote:LoadModule rewrite_module modules/mod_rewrite.c
is uncommented in my httpd.conf (becuase mod_rewrite shows in phpinfo(); I can be sure of this.)

I still havent been able to test the ideas to fix the problem, Ill be doing it tonight.




Theme © iAndrew 2016 - Forum software by © MyBB