-
AuthorPosts
-
Pankaj Sharma Moderator
Pankaj Sharma
- Join date:
- February 2015
- Posts:
- 24589
- Downloads:
- 144
- Uploads:
- 202
- Thanks:
- 127
- Thanked:
- 4196 times in 4019 posts
timpennington Friendtimpennington
- Join date:
- May 2009
- Posts:
- 242
- Downloads:
- 33
- Uploads:
- 14
- Thanks:
- 12
- Thanked:
- 1 times in 1 posts
January 8, 2018 at 10:22 pm #1085638Thanks; the instruction you gave me say this:
Modify error.php to Redirect 404 Errors to your 404 Article
Edit the error.php file as follows, adding the code below immediately under the ‘restricted access’ line:
If you are using Joomla 1.6, 1.7, 2.5, or 3.x please use this detection code:if (($this->error->getCode()) == ‘404’) {
header(‘Location: /index.php?option=com_content&view=article&id=75’);
exit;
}Where is the "restricted access line"?
Here is what I have in my error.php file:
<?php
/**- JA Healthcare Template
- Copyright (C) 2004-2011 J.O.O.M Solutions Co., Ltd. All Rights Reserved.
- @license – Copyrighted Commercial Software
- Author: J.O.O.M Solutions Co., Ltd
- Websites: http://www.joomlart.com – http://www.joomlancers.com
- This file may not be redistributed in whole or significant part.
-
*/
defined(‘JEXEC’) or die;
if (!isset($this->error)) {
$this->error = JError::raiseWarning(404, JText::(‘JERROR_ALERTNOAUTHOR’));
$this->debug = false;
}
//get language and direction
$doc = JFactory::getDocument();
$this->language = $doc->language;
$this->direction = $doc->direction;
$theme = JFactory::getApplication()->getTemplate(true)->params->get(‘theme’, ”);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>">error->getCode(); ?> – title; ?>
<link rel="stylesheet" href="baseurl ?>/templates/template ?>/css/error.css” type=”text/css” />
<link rel="stylesheet" href="baseurl ?>/templates/template ?>/css/themes//error.css” type=”text/css” />
</script>
<body class="page-error">
<div class="main">
<div class="error">
<div id="outline">
<div id="errorboxoutline">
<div id="animationSandbox" class="error-code bounceInDown animated">
<?php
$errcode = str_split($this->error->getCode());
$i = 0;
$lastclass=”;
foreach($errcode as $c){
$firstclass = ($i==0)?’first’:”;
if($i==(count($errcode)-1)){
$lastclass=’last’;
}
echo ‘<span class="’.$lastclass.$firstclass.’ error-‘.$c.’">’.$c.’‘;
$i++;
}
?><div class="error-message"><h2><?php echo $this->error->getMessage(); ?></h2></div> <div id="errorboxbody"> <p><?php echo JText::_('JERROR_LAYOUT_PLEASE_TRY_ONE_OF_THE_FOLLOWING_PAGES'); ?></p> <a class="button-home" href="<?php echo $this->baseurl; ?>/index.php" title="<?php echo JText::_('JERROR_LAYOUT_GO_TO_THE_HOME_PAGE'); ?>"><?php echo JText::_('JERROR_LAYOUT_HOME_PAGE'); ?></a> </div> </div> </div> </div> </div>
Pankaj Sharma ModeratorPankaj Sharma
- Join date:
- February 2015
- Posts:
- 24589
- Downloads:
- 144
- Uploads:
- 202
- Thanks:
- 127
- Thanked:
- 4196 times in 4019 posts
January 9, 2018 at 2:02 am #1085681Hi
You have to define this codeif (($this->error->getCode()) == '404') { header('Location: /index.php?option=com_content&view=article&id=75'); exit; }
after
$theme = JFactory::getApplication()->getTemplate(true)->params->get(‘theme’, ”);
?>
and change the article id with your article id.If any issue share site super user details and article ID in private reply.
I will do this for you.Regards
timpennington Friendtimpennington
- Join date:
- May 2009
- Posts:
- 242
- Downloads:
- 33
- Uploads:
- 14
- Thanks:
- 12
- Thanked:
- 1 times in 1 posts
January 9, 2018 at 3:16 am #1085694This reply has been marked as private.Pankaj Sharma ModeratorPankaj Sharma
- Join date:
- February 2015
- Posts:
- 24589
- Downloads:
- 144
- Uploads:
- 202
- Thanks:
- 127
- Thanked:
- 4196 times in 4019 posts
January 9, 2018 at 3:30 am #1085698Hi
I have not found the URL of the site in your last post.
Kindly share it so i can check it on your siteRegards
timpennington Friendtimpennington
- Join date:
- May 2009
- Posts:
- 242
- Downloads:
- 33
- Uploads:
- 14
- Thanks:
- 12
- Thanked:
- 1 times in 1 posts
January 10, 2018 at 9:09 pm #1086135buddywheatley.com
Pankaj Sharma ModeratorPankaj Sharma
- Join date:
- February 2015
- Posts:
- 24589
- Downloads:
- 144
- Uploads:
- 202
- Thanks:
- 127
- Thanked:
- 4196 times in 4019 posts
January 11, 2018 at 2:22 am #1086198Hi
I added the code in error.php here: http://prntscr.com/hyso0w
Kindly check it working fine.Regards
timpennington Friendtimpennington
- Join date:
- May 2009
- Posts:
- 242
- Downloads:
- 33
- Uploads:
- 14
- Thanks:
- 12
- Thanked:
- 1 times in 1 posts
January 12, 2018 at 5:44 pm #1086533Thank you so much!
Pankaj Sharma ModeratorPankaj Sharma
- Join date:
- February 2015
- Posts:
- 24589
- Downloads:
- 144
- Uploads:
- 202
- Thanks:
- 127
- Thanked:
- 4196 times in 4019 posts
January 15, 2018 at 1:13 am #1086671You are welcome!
-
AuthorPosts
This topic contains 9 replies, has 2 voices, and was last updated by Pankaj Sharma 6 years, 10 months ago.
The topic ‘Using a 404 Error Page’ is closed to new replies.