How to make 404 pages using twig in CakePHP3? - cakephp

I am using Twig in Cakephp3. I can not create an error page.
I created a file error400.twig and error500.twig in the src/Template/Error folder. However, when accessing a strange URL, an error of nginx is displayed. I can not find the Japanese Twig help page (I am Japanese).

Related

How do I access a file in a directory from html in a Wordpress Site?

I am trying to use reactjs components in wordpress. I was following this tutorial -
https://jhinter.medium.com/using-react-based-web-components-in-wordpress-f0d4097aca38
Until I got stuck at the last part: I have added this as an html custom block to an empty page:
<script src="/apps/csptest-component/direflowBundle.js"></script>
<csptest-component></csptest-component>
The console prints out:
GET http://www.adminprofi.com/apps/csptest-component/direflowBundle.js net::ERR_ABORTED 404 (Not Found)
I have used FTP to put the file in a folder called apps/csptest-component in the root directory of the wordpress site and I can see that the upload was successful. Do I need to change the link that the src is pointing to? Any help is appreciated!
WordPress allows you to access files in the wp-content directory, so best practice would be to have a child theme setup and then you can upload your javascript to the directory: wp-content/themes/child/js and access it using http://www.adminprofi.com/wp-content/themes/child/js/direflowBundles.js .
It's recommended to use a child theme to ensure your script doesn't get removed when your theme is updated (plenty of resources on how to do this). Create a folder in here called js for tidiness.
EDIT: I think it will be easiest for you to upload your script to: /wp-content/themes/Divi/js folder, and then you can access your script like: <script src="http://www.adminprofi.com/wp-content/themes/Divi/js/yourscriptname.js"></script>

Why is json files not accessible after build?

I have a project in react that works on the computer excellently.
But after I do build and upload it to the server all the json files in the public folder get a 404 error (even when I try to access them directly and click on the url I get the same error.)
But the icon and png files from the same folder do appear.
Another problem (which is probably also related) is that when I go through the link pages on the site it goes great. But if I type them directly in the url I get a 404 error message
I tried to add to json
"homepage": ".", "
But even that did not help.
Anyone have an idea?
edit:
the json works .. I had to change the settings of the mime types according to the instructions: https: //docs.plesk.com/en-US/obsidian/administrator-guide/website-management/websites-and-domains/extended- website-management / using-virtual-directories-windows / adding-and-removing-mime-types.65216 /
But I was still left with the problem that when I go directly to the url address it makes me an error page (when the project is on the local host, it works fine!)
Regards,

How do i create a custom 404 page in Laravel 5.7?

Can anyone help me to create a custom 404 page in laravel 5.7, i am new to laravel so it'd great if you tell me the flow for this.
Thanks
Create 404.blade.php file in errors folder inside your views and make customizations that you want.
OR
You can also use vendor:publish command to publish all the errors blade defined in core.
php artisan vendor:publish --tag=laravel-errors
This will create an errors folder in your views directory and in it there will be all error blade files. You can customize 404.blade.php in it.
#Kamal's solution is good if you want to use a static 404 file. For more customization you can create a proper 404 controller.
To do so first create a controller and method for handling the 404 page (or add a method to an existing controller). Then, tell Laravel to redirect to that controller if no other route was found by adding this at the end of your routes\web.php file. Here's an example:
Route::get('404', 'PageController#render_404_page');
Route::fallback(function () {
return redirect('404');
});
This gives you the freedom to add more logic to 404 pages.

angular js path returns 404 error when https is used

Please keep in mind, I have not worked with angular JS, nor did I write the code that is causing the error.
I am getting an 404 error on this path:
https://www.helivalues.com/Su6UsWuf/bb/option/mfg/all
but not this path:
http://www.helivalues.com/Su6UsWuf/bb/option/mfg/all
It was noticed that when a user views a certain page in https, the drop down does not load options. Angular Js makes a call to the path mention above which is not an actually file but is used by a php file that based on this path, has a switch that fills in the drop down.
Any ideas on how to get the https version to work? This is on a joomla site and I do have access to the htaccess file if needed. I really just need it to work for a few months while I work on building a new site.
Thanks!
Angularjs is not the issue. Your webserver (Apache/2.2.15 (SuSE) Server at www.helivalues.com Port 443) states the file can not be found. So it looks like something is misconfigured with your apache site.

CakePHP some images don't display because of NetworkError: 403 Forbidden

I have a problem on my view. The problem is that some images on external server do not display. I check FireFox console and get the following message:
"NetworkError: 403 Forbidden - http://xxxxx.com/image.jpg"
Although I can view this image by typing directly http://xxxxx.com/image.jpg to URL or save the view as HTML and view it.
Did I do something wrong in configuration?
I use:
CakePHP 2.3.1
smarty 3.1.13
Apache 2.2.23
MySQL 5.3.30
CentOS 6.3
thanks in advance.

Resources