Welcome Guest, Not a member yet? Register   Sign In
Object not found
#1

(This post was last modified: 11-18-2014, 09:42 PM by davy_yg.)

http://localhost/CI220-CRUD/member_area/


autoload.php



PHP Code:
$autoload['helper'] = array('html','form''url'); 


controllers/member_area.php


PHP Code:
class Member_area extends CI_Controller {
 
   function __construct()
 
   {
 
       parent::__construct();
 
      $this->load->model(array('Mediatutorialaccount'));
 
      $this->load->helper(array('html','url'));
 
   }
 
   
    function index
(){
 
       $data['title'] = 'Member only';
 
       $sub_data = array(
 
           'extra_script' => $this->Mediatutorialaccount->extra_script(),
 
           'column_1'  => $this->Mediatutorialaccount->update_status(),
 
           'column_2'  => $this->Mediatutorialaccount->profile_detail()
 
       );
 
       $data['body'] = $this->load->view('_member_area'$sub_datatrue);
 
       $this->load->view('_output_html'$data);
 
   }
 
   



views/_member_area.php


PHP Code:
<!--script BEGIN-->
<
script type="text/javascript">
$(
document).ready(function(){
 
 get_html_data(base_url+"profile/show_details/",'''profile_detail_loading''profile_detail');
});

function 
edit_detail(){
 
   get_html_data(base_url+"profile/show_details/edit/",'''profile_detail_loading''profile_detail');
}

function 
edit_detail_pass(){
 
   get_html_data(base_url+"profile/show_details/edit/pass/",'''profile_detail_loading''profile_detail');
}

function 
kembali(){
 
   get_html_data(base_url+"profile/show_details/",'''profile_detail_loading''profile_detail');
}

<?=
$extra_script?>
</script>
<!--script END-->
<style>
#profile_detail table td{
  vertical-align: text-top;
}
</style>
<div class="column_1" style="width:400px;">
    <?=$column_1?>
</div>

<div class="column_2" style="width:285px;">
    <?=$column_2?>
</div> 


views/_output_html.php


PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<
head>
    <
title><?=$title?></title>
        
    <link href="<?=base_url()?>templates/css/general.css" rel="stylesheet" type="text/css" />
    <script src="<?=base_url()?>templates/js/functions.js" type="text/javascript" language="javascript"></script>
    <script src="<?=base_url()?>templates/js/jquery-1.6.1.min.js" type="text/javascript" language="javascript"></script>
    <!-- script lanjutan-->
    <script type="text/javascript">
    var base_url = "<?=base_url()?>";
    </script>

</head>
<body>


<!--BEGIN MAIN DIV-->
<div class="mainDiv">
<h2>THIS IS CRUD</h2>

<?=$body?>
</div>
<!--END OF MAIN DIV-->
 
    </body>
</html> 


config/routes.php


PHP Code:
$route['default_controller'] = "welcome";
$route['404_override'] = '';
$route['member_area'] = "member_area"



When I try to access :  http://localhost/CI220-CRUD/member_area/


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 [email=postmaster@localhost]webmaster[/email].
Error 404
localhost
Apache/2.4.7 (Win32) OpenSSL/0.9.8y PHP/5.4.22
" If I looks more intelligence please increase my reputation."
Reply
#2

It seems your .htaccess is not working correctly.


Try below steps:

1. Check if apache is configured to support .htaccess.
Code:
<Directory "/var/www/html">
    Options -Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

2. Put below .htaccess under CI220-CRUD folder if not exists or correct it if as per below example
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /CI220-CRUD/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

3. Make sure, base_url config variable under config.php is set to as per below example
Code:
$config['base_url']    = 'http://localhost/CI220-CRUD';

4. Make sure, index_page config variable under config.php is set to blank (Just check below example)
Code:
$config['index_page'] = '';


Try this and let me know if it works.
Reply
#3

I did all the steps. Except that I do not know how to do (Step no. 1):

1. Check if apache is configured to support .htaccess.

I do not know which file to modify in apache ?:

<Directory "/var/www/html">
Options -Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
" If I looks more intelligence please increase my reputation."
Reply
#4

(This post was last modified: 11-19-2014, 04:22 AM by tapan.thapa.)

You can also try your urls like below if you are unable to enable .htaccess support under your apache installation.

http://localhost/CI220-CRUD/index.php/member_area/

--------------------------------------------
I hope, you are on Windows Box.

If you are using WAMP than follow below steps.

Open my computer and travel to below folder.

C:\wamp\bin\apache\Apache2.4.4\conf (My WAMP installation is under C:\wamp and your one might be different)

open httpd.conf under notepad

and look (Do CTRL+F for searching) for this directive "AllowOverride".

It should be under

<Directory "c:/wamp/www">

   
    Options Indexes FollowSymLinks


    AllowOverride All #AllowOverride line should be like RED COLOR value.
    
    Order Deny,Allow

    Deny from all
    Allow from 127.0.0.1
    Allow from ::1
    Allow from localhost
</Directory>

Once modified, save it and than restart apache.

Else

Let me know your OS details...
Reply
#5

For one your base_url should end with a forward slash /

Run phpinfo and see if mod rewrite is turned on in php.ini.

Also if you leave the base_url blank CI will try to figure it out for you.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB