CodeIgniter Forums
404 error when using rewrite engine - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: 404 error when using rewrite engine (/showthread.php?tid=14035)



404 error when using rewrite engine - El Forum - 12-16-2008

[eluser]walrus_lt[/eluser]
Hello, i am getting an 404 error when using rewrite engine when i am accessing, http://localhost/projects/ but when trying access http://localhost/projects/welcome/ then everything works fine. What's the problem? Sad

Code:
<IfModule mod_rewrite.c>
    DirectoryIndex index.php
    RewriteEngine on
    RewriteCond $1 !^(index\.php|google254b42e34114b586\.html)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
</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>



404 error when using rewrite engine - El Forum - 12-16-2008

[eluser]walrus_lt[/eluser]
Here is debug info :/

Code:
DEBUG - 2008-12-16 08:47:27 --&gt; Config Class Initialized
DEBUG - 2008-12-16 08:47:27 --&gt; Hooks Class Initialized
DEBUG - 2008-12-16 08:47:27 --&gt; URI Class Initialized
ERROR - 2008-12-16 08:47:27 --&gt; 404 Page Not Found --&gt; artgallery



404 error when using rewrite engine - El Forum - 12-16-2008

[eluser]PowerCode[/eluser]
I'm assuming that, as you've written, you have your CI application inside a folder named projects.

This one works fine for me, should do the same even with you.

Code:
RewriteEngine On
RewriteBase /projects
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

You don't need to explicitly specify file names to exclude from rewriting. The URL will not be re-written if the requested folder/file already exists on the system


404 error when using rewrite engine - El Forum - 12-16-2008

[eluser]walrus_lt[/eluser]
Thanks Big Grin