CodeIgniter Forums
Problem with URI - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Problem with URI (/thread-16963.html)

Pages: 1 2 3


Problem with URI - El Forum - 03-21-2009

[eluser]MicroBoy[/eluser]
I changed this to blank like you can see:
Code:
$config['index_page'] = "";

When I want to open:
Code:
http://localhost/ele/home
It says:
Code:
Object not found!

The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.
Error 404
localhost
03/22/09 03:10:48
Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i mod_autoindex_color PHP/5.2.8

When I write:
Code:
http://localhost/ele/index.php/home
The web-page opens perfect

p.s. Any one can help me? Meaby I didn't post in the right place cause I'm new here sorry.


Problem with URI - El Forum - 03-21-2009

[eluser]cmark[/eluser]
simple: if you uses $config['index_page'] = ""; you need the .htacces

http://ellislab.com/codeigniter/user-guide/general/urls.html

Wink


Problem with URI - El Forum - 03-22-2009

[eluser]MicroBoy[/eluser]
It's To easy when you know the answer, THNX a lot. But now:

I have this link
Code:
<a href="shto">Kthehu</a>

And in webpage it shows http://localhost/ele/index.php/shto , is any way to remove this index.php



Problem with URI - El Forum - 03-22-2009

[eluser]Nevio[/eluser]
Few things....

1.)

Code:
$config['base_url']    = "http://localhost/ele";

2.)

Code:
$config['index_page'] = "";


3.)
Code:
$config['uri_protocol']    = "REQUEST_URI";


4.)

.htaccess file

Code:
# Set directory index to index.php
DirectoryIndex index.php

# Rewrite base to work on all mayor operating systems
RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]

# Block directory listings
Options -Indexes


5.) Go load http://localhost/ele/home . Btw home controller must exists as index method. You must have mod rewrite ( Apache ) enabled.

6.) If this don't help well.. Than I dun know what's your problem about.


Problem with URI - El Forum - 03-22-2009

[eluser]MicroBoy[/eluser]
-------------------------------------------------------------------
3)
Code:
$config['uri_protocol']    = "REQUEST_URI";
When I do this, for every page it says "The page you requested was not found."

4)------------------------------------------------------
Code:
# Set directory index to index.php
DirectoryIndex index.php

# Rewrite base to work on all mayor operating systems
RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]

# Block directory listings
Options -Indexes
When I do this, and I want to open a page everyting is blank I just need to set the .htaccess to:

Code:
RewriteEngine on

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

RewriteCond $1 !^(index\.php|images|img|css|js|robots\.txt)
RewriteRule (.*) index.php/$1 [L]
-----------------------------------------------


Problem with URI - El Forum - 03-22-2009

[eluser]Nevio[/eluser]
When I do this, for every page it says “The page you requested was not found.”

Check if your controller exist. I'm seeing "The page you requested was not found" error only if my method doesn't exist or controller.

set this one than

Code:
# Set directory index to index.php
DirectoryIndex index.php

# Rewrite base to work on all mayor operating systems
RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|images|img|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]

# Block directory listings
Options -Indexes

This above MUST WORK. I spend hours and hours and this works for me on linux, windows and mac systems.

If you still cannot find solution, hmm... than I must say I dun know the answer. ( need to see code to be able fix it. )


Problem with URI - El Forum - 03-22-2009

[eluser]MicroBoy[/eluser]
Meaby I made a mistake while I was coding and I don't know what I did wrong, anyway thnx for try.


Problem with URI - El Forum - 03-23-2009

[eluser]menslow[/eluser]
I think I'm having the same problem as MicroBoy...

I'm getting a "404 not found" on my local workstation for the following URL:
http://localhost/michaelenslow2/services

The page loads fine when I go to:
http://localhost/michaelenslow2/index.php/services



I've done the following:

1. Set:
Code:
$config['base_url']    = "http://localhost/michaelenslow2";

2. Set:
Code:
$config['index_page'] = "";

3. Set:
Code:
$config['uri_protocol']    = "REQUEST_URI";

4. .htaccess file:

Code:
# Set directory index to index.php
DirectoryIndex index.php

# Rewrite base to work on all mayor operating systems
RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]

# Block directory listings
Options -Indexes


5. And here's my services controller:
Code:
&lt;?php

class Services extends Controller {

    function Services()
    {
        parent::Controller();    
    }
    
    function index()
    {
        $this->load->view('services');
    }
}



6. Here's my OS setup:

OS: mac 10.5
Web Server: Apache 2.0
PHP version: 5.2.6


Any ideas? Probably something silly.


Problem with URI - El Forum - 03-23-2009

[eluser]TheFuzzy0ne[/eluser]
What's your file name? You need to ensure it's all lowercase.


Problem with URI - El Forum - 03-23-2009

[eluser]menslow[/eluser]
Thanks for the reply TheFuzzyOne...

My controller file name is: services.php (all lowercase)