when the user is not logged in, I want to redirect the error_page to login in page. I referred to : https://www.drupal.org/forum/support/post-installation/2006-04-22/how-do-i-redirect-anonymous-users-to-a-login-page#comment-126045
and modified my error_page. I added php code to redirect the anonymous user to login page. The page already had only HTML code. After I added my php code, the HTML part is not working well. The picture in the HTML is not displaying. . I chose “PHP code” as text format and my code looks like this:
<?php global $ user; $ referer = $ _SERVER['REQUEST_URI']; if(($ user->uid==0)&&(preg_match('/blogs/i',$ referer))) header("Location: /user"); ?> #HTML part of the code, which has problem displaying : [[{"fid":"5698","view_mode":"default","fields":{"format":"default","field_file_image_alt_text[und][0][value]":"Billy","field_file_image_title_text[und][0][value]":"Billy"},"type":"media","field_deltas":{"1":{"format":"default","field_file_image_alt_text[und][0][value]":"Billy","field_file_image_title_text[und][0][value]":"Billy"}},"attributes":{"alt":"Billy","title":"Billy","class":"media-element file-default","data-delta":"1"}}]]
Other HTML code is working. The above HTML piece is supposed to print a picture and is not working. I am new to Drupal. Can you please help me understand what is going wrong here.