Welcome Guest, Not a member yet? Register   Sign In
[solved] can't get my path working...
#1

[eluser]m_ologin[/eluser]
Hi there, I have tried doing a simple web page with a form but get a 404 error, probably because I haven't configured my app right. Can someone please help?

Here is my file structure:

Code:
+ci
  +application
  +public_html
    +css
    +flash
    +img
    +js
    index.html
  +system
  +user_guide
  .htaccess
  index.php
  license.txt

.htaccess:
Code:
<IfModule mod_rewrite.c>
  DirectoryIndex index.php
  RewriteEngine on
  RewriteBase /ci/
  RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php/$1 [L,QSA]
</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule>

config.php:
Code:
&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$config['base_url']   = "http://localhost/ci/";
$config['index_page'] = "";
(...)

index.php:
Code:
(...)
$system_folder = "system";
$application_folder = "application";
(...)

routes.php:
Code:
&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$route['default_controller'] = "login";
$route['scaffolding_trigger'] = "";

login.php (in controller folder):
Code:
&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Login extends Controller {
    function Login()
    {
        parent::Controller();
    }
    
    function index()
    {
        echo "ok";
    }
    
    function submit()
    {
        echo "submitting";
    }
}

Now, when I go to http://localhost/ci/, it displays "ok" correctly. Yet, when I go to http://localhost/ci/login/submit, I have a 404 error.
The page can only be found at http://localhost/ci/index.php/login/submit...

Please advise. Thanks!

[SOLVED] :
I changed my <DIRECTORY> section to this:
<Directory />
Options All
AllowOverride All
</Directory>
in my httpd.conf apache file. Not great for security but I'm just working local for now...

Thanks!
#2

[eluser]Vicente Russo[/eluser]
Hi,

Try this:

<IfModule mod_rewrite.c>
DirectoryIndex index.php
RewriteEngine on
RewriteBase /ci/
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
</IfModule>
#3

[eluser]m_ologin[/eluser]
No.. It still doesn't work. I have simplified my example (check above); but I still haven't managed to take out the index.php...
#4

[eluser]brianw1975[/eluser]
IIRC AllowOverride All is the requirement for using mod_rewrite so just tweak your Options tag and you'll be fine.

something like:

Code:
Options -Indexes -FollowSymlinks +FollowSymLinkIfOwnerMatch

should keep all the baddies from getting access to junk outside the webroot - as long as *you* know what you are doing hehe




Theme © iAndrew 2016 - Forum software by © MyBB