No 404 on existing folders |
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) 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 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
There should be an htaccess file in both the system and application directories not allowing access (via url) by default. Are those present?
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
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) 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.
This is a somewhat wild guess, but shouldn't the following work (if placed before your existing rules)?
Code: RewriteRule ^application/* - [F] (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)? 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"
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.
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 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 and routing settings: Code: $route['default_controller'] = "store"; 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 |
Welcome Guest, Not a member yet? Register Sign In |