[Riješeno]Redirect

Autor komir, 18. Studeni 2011, 11:56

0 Članovi i 1 Gost pregledava ovu temu.

komir

Napravio sam redirekciju preko .htaccess
RewriteCond %{HTTP_HOST} ^*****\.hr$ [OR]
RewriteCond %{HTTP_HOST} ^www\.******\.hr$
RewriteRule ^(.*)$ "http\:\/\/www\.********\.com\/$1" [R=301,L]

Može li se nekako staviti da prije nego preusmejri na novu stranicu da napiše neku poruku tipa Stranica je premještena na novu lokaciju i bla, bla ..
Izrada web stranica Domidona IT
Prirodni vrcani  med
Profesionalni Hrvatski SSD Hosting

wooer

Za takvo nešto se u praksi ne radi redirekcija kroz .htaccess već se kreira index.html koji će biti zadužen za prikaz poruke i konačno preusmjeravanja na novu stranicu.
Primjer možeš vidjeti recimo ovdje http://www.w3schools.com/html/tryit.asp?filename=tryhtml_redirect
UNIX is basically a simple operating system, but you have to be a genius to understand the simplicity
Documentation & Translation Team Member

komir

Citat: wooer  u 18. Studeni 2011, 12:11
Za takvo nešto se u praksi ne radi redirekcija kroz .htaccess već se kreira index.html koji će biti zadužen za prikaz poruke i konačno preusmjeravanja na novu stranicu.
Primjer možeš vidjeti recimo ovdje http://www.w3schools.com/html/tryit.asp?filename=tryhtml_redirect
... hvala, napravio, ali to radi ako korisnik ide na inex, ali ako ide na neki link koji je google indexirao npr. www.domena.com/nesto/ onda dobijem
Not Found

The requested URL /index.php was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Izrada web stranica Domidona IT
Prirodni vrcani  med
Profesionalni Hrvatski SSD Hosting

marko227

Onda otvori templates/system/error.php i zamjeni ovo
if (!isset($this->error)) {
$this->error = JError::raiseWarning( 403, JText::_('ALERTNOTAUTH') );
$this->debug = false;
}


Sa ovim
if (($this->error->code) == '404') {
header('Location: http://tvojadomena.com/index.html');
exit;
}

komir

Hvala, an pomoći, ali moja greška, krivo postano,  >:D radi se o joomli 1.5, ne mogu naći dio
Citat:if (!isset($this->error)) {
   $this->error = JError::raiseWarning( 403, JText::_('ALERTNOTAUTH') );
   $this->debug = false;
}
koji ste mi napisali?
Izrada web stranica Domidona IT
Prirodni vrcani  med
Profesionalni Hrvatski SSD Hosting

erbi

Umjesto
Citat:// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
if (!isset($this->error)) {
   $this->error = JError::raiseWarning( 403, JText::_('ALERTNOTAUTH') );
   $this->debug = false;
stavi
Citat:// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
header ("Location: /"); exit();
if (!isset($this->error)) {
   $this->error = JError::raiseWarning( 403, JText::_('ALERTNOTAUTH') );
   $this->debug = false;

komir

Citat: erbi  u 18. Studeni 2011, 18:29
Umjesto
Citat:// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
if (!isset($this->error)) {
   $this->error = JError::raiseWarning( 403, JText::_('ALERTNOTAUTH') );
   $this->debug = false;
stavi
Citat:// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
header ("Location: /"); exit();
if (!isset($this->error)) {
   $this->error = JError::raiseWarning( 403, JText::_('ALERTNOTAUTH') );
   $this->debug = false;

Još jednom hvala na trudu ali nema  ???
evo moj
templates/system/error.php
<?php
/**
 * @version $Id: error.php 21322 2011-05-11 01:10:29Z dextercowley $
 * @package Joomla.Site
 * @copyright Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
 * @license GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;
if (!isset(
$this->error)) {
$this->error JError::raiseWarning(404JText::_('JERROR_ALERTNOAUTHOR'));
$this->debug false;
}
//get language and direction
$doc JFactory::getDocument();
$this->language $doc->language;
$this->direction $doc->direction;
?>

<!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?>">
<head>
<title><?php echo $this->error->getCode(); ?> - <?php echo $this->title?></title>
<link rel="stylesheet" href="<?php echo $this->baseurl?>/templates/system/css/error.css" type="text/css" />
<?php if ($this->direction == 'rtl') : ?>
<link rel="stylesheet" href="<?php echo $this->baseurl?>/templates/system/css/error_rtl.css" type="text/css" />
<?php endif; ?>
</head>
<body>
<div class="error">
<div id="outline">
<div id="errorboxoutline">
<div id="errorboxheader"><?php echo $this->error->getCode(); ?> - <?php echo $this->error->getMessage(); ?></div>
<div id="errorboxbody">
<p><strong><?php echo JText::_('JERROR_LAYOUT_NOT_ABLE_TO_VISIT'); ?></strong></p>
<ol>
<li><?php echo JText::_('JERROR_LAYOUT_AN_OUT_OF_DATE_BOOKMARK_FAVOURITE'); ?></li>
<li><?php echo JText::_('JERROR_LAYOUT_SEARCH_ENGINE_OUT_OF_DATE_LISTING'); ?></li>
<li><?php echo JText::_('JERROR_LAYOUT_MIS_TYPED_ADDRESS'); ?></li>
<li><?php echo JText::_('JERROR_LAYOUT_YOU_HAVE_NO_ACCESS_TO_THIS_PAGE'); ?></li>
<li><?php echo JText::_('JERROR_LAYOUT_REQUESTED_RESOURCE_WAS_NOT_FOUND'); ?></li>
<li><?php echo JText::_('JERROR_LAYOUT_ERROR_HAS_OCCURRED_WHILE_PROCESSING_YOUR_REQUEST'); ?></li>
</ol>
<p><strong><?php echo JText::_('JERROR_LAYOUT_PLEASE_TRY_ONE_OF_THE_FOLLOWING_PAGES'); ?></strong></p>

<ul>
<li><a 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></li>
</ul>

<p><?php echo JText::_('JERROR_LAYOUT_PLEASE_CONTACT_THE_SYSTEM_ADMINISTRATOR'); ?>.</p>
<div id="techinfo">
<p><?php echo $this->error->getMessage(); ?></p>
<p>
<?php if ($this->debug) :
echo $this->renderBacktrace();
endif; ?>

</p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
Izrada web stranica Domidona IT
Prirodni vrcani  med
Profesionalni Hrvatski SSD Hosting

marko227

Umjesto
if (!isset($this->error)) {
$this->error = JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
$this->debug = false;
}


Stavi
if (($this->error->code) == '404') {
header('Location: http://tvojadomena.com/index.html');
exit;
}

komir

Izrada web stranica Domidona IT
Prirodni vrcani  med
Profesionalni Hrvatski SSD Hosting