Welcome Guest, Not a member yet? Register   Sign In
index.ph on url problem.
#1

[eluser]ryanermita[/eluser]
i having a problem with the index.php on my url. when i removed it, it gives me an error of:

"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
Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7"

the code inside the .htaccess file located inside the application folder:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]

together using this htaccess i remove the index.php inside the config.php "$config['index_page']"

and when i return the index.php. the connection of my css when reload using different function is not working. on homepage the css is working but when i test my code and reload again the login page the css is not working.
heres my controller function:
<?php
Class Administrator extends CI_Controller{
function index(){
$this->load->view('administrator_view');
}
function validate_credentials(){
$this->load->model('administrator_model');
$query = $this->administrator_model->validate();
if($query){
$data = array(
'username' => $this->input->post('username'),
'is_logged_in' => true
);
$this->session->set_userdata($data);
redirect('dashboard/home');
}
else{
$this->index();
}
}
}
?>


thank you, im just a beginner using this framework. and sorry for my bad english
#2

[eluser]TheFuzzy0ne[/eluser]
Welcome to the CodeIgniter forums!

1) Ensure your vhost has:
Code:
AllowOverride All
[/code]

2) Make sure your .htaccess file does not have a file extension (Windows won't let you create .htaccess files by default -- it just wigs out and thinks you've given an extension bu no filename).

3) Test your .htaccess file is actually being loaded. Change an instance of "RewriteCond" to "Rewrite Cond" (note the space). When you refresh the page, you should get a 500 error. If you do, remove the space and save the file.

4) Try changing:
Code:
RewriteRule ^(.*)$ /index.php/$1 [L]

to one of the following:
Code:
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteRule ^(.*)$ /index.php?$1 [L]
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteRule ^(.*)$ index.php?$1 [L]

You'll need to try each one separately, and refresh the page to test it. Hopefully one of this will work.
#3

[eluser]ryanermita[/eluser]
sir i tried to put .htaccess with AllowOverride All inside the application folder and the .htaccess outside the application folder with
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
#RewriteRule ^(.*)$ /index.php?$1 [L]
#RewriteRule ^(.*)$ index.php?/$1 [L]
#RewriteRule ^(.*)$ index.php?$1 [L]
changing the RewriteRule ^(.*)$ /index.php?/$1 [L] to the choices you give. and interchange the htaccess inside the application folder and outside of it. but its still not working. when i try to go to the other pages.

i also check phpinfo() if the mod_rewrite is loaded. and yes it is.

btw. thank you for your response sir Smile
#4

[eluser]TheFuzzy0ne[/eluser]
Did you confirm that your .htaccess file is doesn't have a file extension (such as .htaccess.txt)?
Did you confirm that the file is being loaded, by introducing a syntax error into the file to see if it throws a 500 error?
Your .htaccess file needs to be in your Web root, not in your application directory.
#5

[eluser]jairoh_[/eluser]
this is what i wrote in my .htaccess file which is doing fine
Code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
#6

[eluser]ryanermita[/eluser]
[quote author="TheFuzzy0ne" date="1369386154"]Did you confirm that your .htaccess file is doesn't have a file extension (such as .htaccess.txt)?
Did you confirm that the file is being loaded, by introducing a syntax error into the file to see if it throws a 500 error?
Your .htaccess file needs to be in your Web root, not in your application directory.[/quote]


yes .htaccess doesn't have a file extension.
RewriteEngine On
Rewrite Cond %{REQUEST_FILENAME} !-f(with spaces, doesnt do anything,even with space)
Rewrite Cond %{REQUEST_FILENAME} !-d(with spaces, doesnt do anything,even with space)
RewriteRule ^(.*)$ /index.php/$1 [L]
. buti checked my phpinfo() and mod_rewrite is included in the loaded modules.
how can i solve this? i think the problem is with my server...
#7

[eluser]ryanermita[/eluser]
[quote author="jairoh_" date="1369390264"]this is what i wrote in my .htaccess file which is doing fine
Code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
[/quote]

i try this one sir. but nothing happens
#8

[eluser]TheFuzzy0ne[/eluser]
OK, you should be getting a 500 error if your .htaccess file was being loaded We need to figure out why it's not being loaded. Remember it needs to be in your Web root, not your application directory.
#9

[eluser]ryanermita[/eluser]
yes my htaccess is located outside the application folder.

there are other .htaccess inside the application with "deny from all", i delete and but nothing happens. and i return it again but change the code iside it with "AllowOverride All" but again nothing change.
#10

[eluser]TheFuzzy0ne[/eluser]
Deleting those files won't help, since they are only effective if the directory is resides in is called directly via your URL.

Are you using XAMP? It might be worth installing a fresh copy (after deleting the old copy). We need to get to the bottom of why it's not being loaded. As far as I'm aware, .htaccess files should work by default, so I suspect you might have changed something without realising that's broken your server.




Theme © iAndrew 2016 - Forum software by © MyBB