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

[eluser]Skuja[/eluser]
Hi, I am new to all of this mod_rewrite thing. So I have followed thiswiki tutorial and still am expieriencing problems with removing index.php from URI.
I have following test controller with following code:
Code:
<?php
class Test_controller extends Controller {
    function index()
    {
        echo 'Hello World!';
        $this->load->helper('url');
        echo anchor('test_controller/test','test');
    }

    function test()
    {
        echo 'Look at this!';
    }
}
?>
when I open http://localhost/test/ it successfuly loads test_controller because it is set as default, but when I click on anchor hyperlink, the webserver throws object not found error, also this error appears when i'm trying to access my page this way: http://localhost/test/test_controller/
When I try to open my page with 'index.php' included in URI like this:
http://localhost/test/index.php/test_controller/
it works just fine.
I am using latest xampp application on windows based system.
The .htaccess file is identical to the one like in the tutorial, mod_rewrite is also set to load in httpd.conf.
So i would like your help to solve my problem to remove index.php form URI.
#2

[eluser]ekeretex[/eluser]
mod rewrite won't work on your local machine if you're running windows.

On my development machine, I leave the 'index.php' there and take it out when I deploy to the staging or production server (linux based).
#3

[eluser]Skuja[/eluser]
Thanks ekeretex for the fast reply.
#4

[eluser]ekeretex[/eluser]
Updating my previous response, Apache doesn't come with mod_rewrite set up by default. However you can enable it if you need to.
I chose not to because I'm not sure if the syntax is exactly the same for Windows and Linux.

But if you want to,
Inside the Apache httpd.conf file uncomment the line LoadModule rewrite_module modules/mod_rewrite.so (remove the pound '#' sign from in front of the line).

Also find the line ClearModuleList is uncommented then find and make sure that the line AddModule mod_rewrite.c is not commented out.

Find the section with Document Root: DocumentRoot "C:/path/to/my/root"

Modify the option for AllowOverride to look like this:

<Directory />
Options All
AllowOverride All
</Directory>

mod-rewrite should now work on your windows box
#5

[eluser]Skuja[/eluser]
I did everything as you said except I didn't had any lines with AddModule and ClearModule.. should I add these manually ?
#6

[eluser]ekeretex[/eluser]
If you don't have those lines, don't bother about them. Just restart apache and it should work.

For what it's worth, I've just dropped the htaccess from my linux box into my windows folder and it works without any changes so maybe I'll start using them too.
#7

[eluser]Skuja[/eluser]
don't know what i've done wrong, but I still got this error message:
Code:
Object not found!

The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

If you think this is a server error, please contact the webmaster.
Error 404
localhost
01/22/08 11:54:18
Apache/2.2.6 (Win32) DAV/2 mod_ssl/2.2.6 OpenSSL/0.9.8g mod_autoindex_color PHP/5.2.5
#8

[eluser]ekeretex[/eluser]
Did you restart apache (although if you didn't and you added an htaccess file, it should give you a 500 error)?
Confirm the htaccess file is at the same level as index.php
#9

[eluser]Skuja[/eluser]
yes .htaccess file is in the same directory where index.php and i've restarted apache several times
#10

[eluser]ekeretex[/eluser]
what url are you trying to get?




Theme © iAndrew 2016 - Forum software by © MyBB