Welcome Guest, Not a member yet? Register   Sign In
No 404 on existing folders
#1

(This post was last modified: 04-12-2015, 06:59 AM by BABYpanda.)

Hey all,

I noticed that when a user browses to example.com/application for instance, he doesn't get a 404 error page but instead get "‹ãRàâ xŽl" as output.

The htaccess I use is
Code:
RewriteCond $1 !^(index\.php|assets|robots\.txt)
RewriteRule ^(.*)$ index.php?/$1 [L]

this seems to be an issue on all subfolders. If a folder doesnt exist I get a 404 error, but if a folder exists like applications it screws me over Sad

Any idea what I am doing wrong?

Thanks in advance.

PS. The error log gives
Code:
ERROR - 2015-04-12 15:50:19 --> 404 Page Not Found --> application
but yet doesn't show me a 404 error page...
Reply
#2

There should be an htaccess file in both the system and application directories not allowing access (via url) by default. Are those present?
Reply
#3

yes, these are all present. These say "Deny from all"
Reply
#4

Anyone an idea perhaps?
Reply
#5

Few ideas:
-Your .htaccess file is pretty nonstandard, try to swap it with other configurations. E.g. with the one from docs.
-Your index.html files in sub folders may be corrupt. Try to rename them and see what happens
-Your .htaccess files in sub folders is maybe not correct. Try to rename them and see what happens
Reply
#6

(This post was last modified: 04-15-2015, 11:49 AM by BABYpanda.)

thanks for you answer, I reset everything and came to conclusion it was this line what is causing the issue:

Code:
RewriteCond $1 !^(index\.php|assets|robots\.txt)
RewriteRule ^(.*)$ index.php?/$1 [L]

Any idea how I can still remove index.php for the url but yet receive a forbidden access when browsing to /application for example ?

EDIT: I found out this has something to do with it being a subdomain rather than a subfolder. When I change the config file the way it works it being a subfolder, everything is working perfectly. No weird symbols when visiting an existing folder like application. But when I change it to a subdomain eg test.example.com it seems to throw in weird symbols when visiting test.example.com/application instead of showing a 403 forbidden or anything similar.

I noticed that a trailing slash is being removed when its a subdomain, and not when it is a subfolder.
Reply
#7

This is a somewhat wild guess, but shouldn't the following work (if placed before your existing rules)?

Code:
RewriteRule ^application/* - [F]
Reply
#8

(This post was last modified: 04-16-2015, 09:58 AM by BABYpanda.)

(04-16-2015, 08:08 AM)mwhitney Wrote: This is a somewhat wild guess, but shouldn't the following work (if placed before your existing rules)?


Code:
RewriteRule ^application/* - [F]

Thanks for your reply though it doesn't seem to work.

The most interesting part is that I loaded a fresh copy and there happens exactly the same. It being a subdomain throws errors at me, while it being a subfolder seems to work flawless. The only thing I want to achieve is remove index.php from the url, and the htaccess given above doesn't seem to work with that properly.

PS. The output is always "‹ãRàâ xŽl" and the log always gives "ERROR - *time* --> 404 Page Not Found --> application"
Reply
#9

Do you have a RewriteBase directive?

Generally, I find mod_rewrite annoying because I spend a significant amount of time to get it working once on a server, and everything makes perfect sense at that point in time. However, when I need to do it again (often months or even years later), none of it makes any sense any more.

It probably doesn't help that Apache 2.4 changes a lot of things.
Reply
#10

(This post was last modified: 04-19-2015, 08:13 AM by BABYpanda.)

Thanks for your reply. The RewriteBase is set to "/" in the htaccess of the subdomain.

I really have no idea why it does these things, pretty much..

Code:
RewriteEngine On
RewriteBase /
RewriteCond $1 !^(index\.php|assets|robots\.txt)
RewriteRule ^(.*)$ /index.php?/$1 [L]

thats the .htaccess in the subdomain.

This url gives a correct 404 error:
http://test.example.com/index.php?/application

but this gives the weirds symbols..
http://test.example.com/application

full log:
Code:
DEBUG - 2015-04-19 16:32:32 --> Config Class Initialized
DEBUG - 2015-04-19 16:32:32 --> Hooks Class Initialized
DEBUG - 2015-04-19 16:32:32 --> Utf8 Class Initialized
DEBUG - 2015-04-19 16:32:32 --> UTF-8 Support Enabled
DEBUG - 2015-04-19 16:32:32 --> URI Class Initialized
DEBUG - 2015-04-19 16:32:32 --> Router Class Initialized
ERROR - 2015-04-19 16:32:32 --> 404 Page Not Found --> application

and routing settings:
Code:
$route['default_controller'] = "store";
$route['404_override'] = '';

server error log shows this line when I browse to the page and get the weird symbols:
Code:
[Sun Apr 19 17:10:42 2015] [error] [client xx.xx.xxx.xxx] client denied by server configuration: /home/xxxxxxxx/domains/example.com/public_html/xxxxxx/application
So it says it is denying the access, yet it shows weird symbols,,
Reply




Theme © iAndrew 2016 - Forum software by © MyBB