Why does my custom 404 work but not my 403? - php

I'm working in a Symfony 2 project (version 2.1.11 to be precise). I'm trying to customize the 403 page returned when using the Symfony firewall. It correctly returns a 403 error but not using my custom page.
I am using the template override method by putting a file at app/Resources/TwigBundle/views/Exception/error403.html.twig. I have an error404.html.twig page right next to it that works OK and is returned for non-existent URLs. I've cleared my cache and I'm testing in the "prod" environment.
Anybody able to tell me where to go next? I'm not sure why the 403 works but the 404 doesn't. If you have a custom 403 working at all, I'd also appreciate a comment on how you did it (maybe I can override that template elsewhere, etc.)

Related

Joomla 404 error in Admin Panel

I am having a strange thing happening to my Joomla site. I am unable to save anything in the Admin Panel. For instance, if I go to "Global Settings" and make any changes (eg site name or even email) and click on Save, I get a 404 Error:
The requested page can't be found.
Error: 404 - View not found [name, type, prefix]: jgive, html, jgiveView
I am using Joomla 3.4 (latest version). Please see the screenshot attached. Is anyone getting any similar error and any idea how to solve this? I have .htaccess enabled in my backend, with SEF Urls turned on. This seems to be happening randomly because the site has been working just fine and suddenly started this behaviour.
Thanks for any help!

Joomla 2.5 no 404 page

I'm having issues with my Joomla installation.
It's a rather vanilla J! 2.5 (latest version) installation with K2 (I don't think it is related to my problem).
The problem is that any URL I make up (such as http://www.mysite.com/No-Such-URL-At-All) gives me the following error:
Error
Article not found
You are not authorised to view this resource.
I created an error.php file that should handle it in the template, but it is not used at all by Joomla, as I don't think it is really handled as error but as a permission redirection :\
So I tried adding this code to my template:
Code:
if (($this->error->code) == '404') {
header('Location: /404.html');
exit;
But no error was detected and the code was also ignored.
I inspected the response headers from the server, but I actually get a response 200, OK response :.
Some additional data that could be usefull
- It's hosted on a godaddy dedicated centos server
- SEF is enabled (problem continues also when disabled)
Let me know if any other information could help...
I really have no other direction I can think of, maybe someone has any idea why any 404 is turned into a permission redirection?
Check to see if when you have a 404 if Joomla is hitting the "com_content" component ( check the $_REQUEST variable). I had this problem and it turned out that it wasn't, it was hitting one of my custom components. If this is the case, here is what you need to do to fix it. For this example, lets say that its hitting 'com_home' instead of 'com_content'.
1). Copy components/com_content/router.php into components/com_home
2). Open components/com_home/router.php and replace all instances of "Content" with "home"
3). Open components/com_home/home.php and add the following lines near the top of the file:
JHtml::_('behavior.tabstate');
require_once JPATH_COMPONENT.'/helpers/route.php';
4). Copy the entire components/com_content/helpers into components/com_home
When that's done, the url mysite.com/does-not-exist should redirect to the error.php page you've set up in your template.

CakePHP: 404 when requesting resources from server

I'm having this problem in my production server. I need to install my local copy of cakephp into a subdiorectory domain.com/cakephp, the I can see al it's contents correctly, the problem comes when the code requests for a controller/method using ajax. I believe this may have something to do with the .htacess, since I got this from javascript console in Chrome:
POST http://domain.com/clientes/lista_grid 404 (Not Found)
when it should be something like
POST http://domain.com/cakephp/clientes/lista_grid 404 (Not Found).
I've tried every possible .htaccess configuration for a cakephp subdirectory install. But no luck, I've got no idea what to do with this.

Symfony2 : error 403 and 404 on prod envrionment

I am facing an issue with Symfony2. I have created a website, it works fine locally.
I can access localhost/symfony/web to see my site on prod. (it doesn't work if I go to app.php, I get redirected to the wamp index page, but it seems to be normal on the Symfony version I use - 2.2.1 )
Online I have a 404 error when I try to access http://www.mywebsite.com/web
If I try to go to any other page (like www.mywebsite.com), I get a 403 error.
But I can go to http://www.mywebsite.com/web/app_dev.php or http://www.mywebsite.com/web/config.php without error.
I am using a shared server (1&1 starter).
I don't see anything in the logs. I have cleared the caches (both dev and prod), but it doesn't change anything.
I am lost... can anyone help me?
Thanks,

Magento incorrect 404 redirect

Magento is redirecting any 404 errors to the admin login. In the admin settings I have the no route setting set to a CMS page that I confirmed exists.
I have been fighting with this for a week. Cleared cache, reindex, rebuilt url rewrites, etc...
If there is a way to completely bypass magento handling 404 I can do this through htaccess just to get it working.
Ideas?
I also went through and disabled any custom modules I had installed to see if they were affecting it. No luck there.
Checked apache/php logs as well as both exception and system logs generated from Magento. Nothing.
If you had experienced a "4xx Error", it means the error occurred on the user/client side.
If you had experienced a "5xx Error", it means the error occurred on the server side.
404 Not Found
The requested resource could not be found but may be available again
in the future.[2] Subsequent requests by the client are permissible.
I'm not sure, but it sounds like the error is in your controller. You are calling a controller action that doesn't exist.
You has checked the settings?
Admin->System->Config->Web->Default Pages
Default No-route URL should be set to 'cms/index/noRoute'
The drop down beneath that show be your 404 page.
Of course you can put the noRoute to your own module, simply put 'yourmodule/yourindexcontroller/whateveraction' in the box.

Categories