cakephp 3.6 can't Display Image - css

I have problem when I Try Display Image on my login page It doesn't appear
<?= $this->Html->image('crm.jpg', ['alt' => 'User image']); ?>
When I check the console on Chrome
Failed to load resource: the server responded with a status of 404 (Not Found)
When I try accessing http://localhost/intellix/img/crm.jpg it says
Error: ImgController could not be found.
Which isn't needed.
crm.jpg is located in webroot/img/
Now the weird part if i change crm with another image name ex: silhouette.png it works fine but so far it only worked with this one
Any Ideas ?
(Note : Using Chrome Cakephp Sublime text Up to date)
Edit : I had the same problem trying to load CSS Scripts Files

It seems that your image crm.jpg does not exist. In this case, CakePHP is routing the request to ImgController. Is the image silhouette.png located in the same directory?
A second thing might be the access right. Maybe it is not readable? Check the access rights and make it at least readable for all.

the problem was indeed in access right in this file
.htaccess inside webroot folder
There was this line which I added
RewriteRule ^(.*)$ index.php [QSA,L]
Restoring it to default Removing it did the trick

Related

WordPress: Media error: Format(s) not supported or source(s) not found

I'm trying to add a MP4 video to my media library. It doesn't give any error but when I try to play the video it gives this message inside the video player:
Media error: Format(s) not supported or source(s) not found
The video size is 2MB.
There seems to be a bug in WordPress Core about this:
https://core.trac.wordpress.org/ticket/42874#comment:8
An issue is also opened in the mediaelement GH repo:
https://github.com/mediaelement/mediaelement/issues/2390
The actual problem comes from Safari:
IMPORTANT NOTE for Safari users (Jun 8, 2017)
Since Sierra version, autoplay policies have changed. You may experience an error if you try to execute play programatically or via autoplay attribute with MediaElement, unless muted attribute is specified.
I've also bumped into this issue, but can only reproduce it in Safari, it works on Chrome and Firefox.
Hope this helps!
Make sure the filename has no spaces, apostrophes, slashes or other non-alphanumeric characters (such as $, % and &). Rename the file before uploading if it does. To preserve readability, it's work for me
Check if there is a .htaccess file in the <wp-root>/wp-content folder of your wordpress installation, this file determines which file the webserver is allowed to make available for download. (You will need access to the server for this, you cannot do this from WordPress itself, I think.)
In my case, this file looked as follows:
# Disable access to all file types except the following
Order deny,allow
Deny from all
<Files ~ ".(xml|css|js|jpe?g|png|gif|pdf|docx|rtf|odf|zip|rar)$">
Allow from all
</Files>
Which means: only allow downloading files with the listed extentions. Any other file (such as mp4) would result in a 403 - Forbidden error.
Fix the problem by adding the mp4 to the list of allowed files:
...
<Files ~ ".(xml|css|js|jpe?g|png|gif|pdf|docx|rtf|odf|zip|rar|mp4)$">
...
After spending several hours trying to find a solution i finally have!
I managed to fix the issue by just changing the file name of the MP4. I had the file name as "video_300x250.mp4". by changing it o simply "video_01.mp4" it fixed the issue for me.
I literally spent so long trying to re-install wordpress, mess about with SSL and plenty of other stuff. Trying to google it no one has found any answer. It might be the fact that there are numbers with the letter "x" in it, or some other combination of letters which doesn't work.
I hope this helps for anyone searching for this.
The easiest solution I came up with is to change the video's format to webm from mp4 that will solve the issue.
Upload your video to YouTube then download it and upload the YouTube download to Wordpress and it works.
I tried a lot for this problem.
But I did not get the result.
and one way fix error is to
delete this code
<Files ".user.ini">
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
</Files>
and
The problem was solved

Symfony2: Stylesheets loaded but not applied on NGINX leading to broken error pages

I've just installed a fresh and clean Symfony app. I'm using NGINX as my webserver.
The stylesheets don't show a http 404 error code in devtools network-tab and i can see their content in the preview-tab correctly.
example picture:
Did someone face any issue like this? I'm guessing it might be a permission issue...
EDIT #1: Attached a picture of the chrome devtools showing the css are loaded correctly.
You need to make sure your nginx.conf actually includes the correct mime-types.
http {
include conf/mime.types;
# ...
... or ...
types {
# ...
text/css css;

Invalid image url throws exception

If I try to visit an invalid image url e.g. example.com/images/non-existent-image an error is thrown: Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException
How should I prevent this, is there a specific route(-requirement) I should add, or should I use something like a .htaccess rule?
Thanks
If it was a permission error you would get sth like permission denies. Check again the path...also check that you have placed the folder images in the proper directory in server (try moving images/ in the same directory where directory WEB-INF is..files under WEB-INF cannot be accessed for security reasons)
Okay the answer to this question is twofold.
First of all: Yes, static resources should not be requested via the front controller (as per thecatontheflat's comment). Symfony has a rule in the .htaccessfile distributed with the standard edition:
# If the requested filename exists, simply serve it.
# We only want to let Apache serve files and not directories.
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .? - [L]
As it turned out, my problem was somewhere else. It is normal for symfony to throw the ResouceNotFoundException. However , this error should be caught and should create a 404 instead. This was not happening because I was using IS_GRANTEDin my error template. (Also see stof's comment here)

How do I edit the .htaccess file to point to a relative directory for a 404 error document?

Most htaccess 404 error rules are based on an absolute directory location, eg /404.php. I want one that is relative to the location it's placed in (so when I transfer from test environment in WAMP to live, I don't have to hope I edit the file right).
Unfortunately,
ErrorDocument 404 404Error.php
Just prints out 404Error.php to the browser, it doesn't call the actual error page like
ErrorDocument 404 /FOOBAR/404Error.php
does.
Edit:
I guess I wasn't clear enough. Test environment is a WAMP local server, with the error file at /FOOBAR/404Error.php while the 'live' server would be www.fubar.com/404error.php -- placing it in the root.
How's this?
ErrorDocument 404 ../directory/404page.html
RewriteBase /FOOBAR/
ErrorDocument 404 404Error.php
This works too, but Tycho's solution is a bit more elegant. Only use this one if you don't plan on using .htaccess for anything outside of /FOOBAR/ pretty much.

Drupal node?destination not working

I've troubles with Drupal 6 and (maybe) mod_rewrite:
if I go to http://127.0.0.1/drupal/node/115/edit?destination=admin%2Fcontent%2Fnode and then I save the node, I don't get redirected to admin/content/node, but it directs me to node/115 :-(
Why??
In my .htaccess I uncommented: RewriteBase /drupal (because my drupal path is /var/www/htdocs/drupal)
My server is running Apache 2.2.4 on Slackware 12
Any help I'll be appreciated :D
It does look like a configuration problem, because this normally works. You can debug it by adding some dsm() dumps in includes/common.inc/drupal_goto() : this is where the destination parameter is processed.
Note that if some module traps your form submission, for instance by declaring a _validate or _submit handler, it can very well change the redirection information: check whether you can reproduce this without contrib modules enabled.

Resources