• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Requested URL not found in server

#3
(11-08-2018, 07:57 AM)dsubhankar Wrote: Here is my .htaccess:

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_URI} ^asset.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

The following items should be removed.

Code:
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond %{REQUEST_URI} ^asset.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

In the case of the system and application, no http request to these folders should be allowed. In fact, as it is shipped, CodeIgniter includes .htaccess files that deny access to those folders and their subfolders. So, those conditions and rules are superfluous and therefore a waste of server resources.

In the case of the asset folder which I assume has things like CSS, JS, and image files you don't want index.php as part of the request.

A typical request for a stylesheet looks like this.

Code:
<link rel="stylesheet" href="https://example.com/assets/css/example.css">

But (unless I'm terribly mistaken) the rewrite you use would result in

Code:
<link rel="stylesheet" href="https://example.com/index.php/assets/css/example.css">

And that's going to fail miserably producing a "404 not found" for the resource.

I also suggest removing the tags <IfModule mod_rewrite.c> </IfModule>.

Yes, you see them used all the time in online examples. But the Apache documentation on <IfModule> has this to say about <IfModule>

Quote:It should not be used to enclose directives that you want to work all the time, because it can suppress useful error messages about missing modules.

It's not critical they be removed, but if you are relying on rewrite working it's probably good to have an error show up in the server logs.

I'm not sure any of those changes will fix the problem though. But they should still be done.

InsiteFX's suggestion of changing

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

to

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

Is a good idea.

I have to ask though, have you followed all the CodeIgniter's rules for file and class naming?
Reply


Messages In This Thread
Requested URL not found in server - by dsubhankar - 11-08-2018, 07:57 AM
RE: Requested URL not found in server - by dave friend - 11-08-2018, 01:48 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.