Jump to content

HTACESS redirects with GET parametrs


skifr

Recommended Posts

Unless you put a query string in the substitution URL, mod_rewrite will keep the original. Apache 2.4 has a flag to disable that but it's so new I doubt you have it.

RewriteRule ^index.php$ http://www.bmeteor.co.il/? [L,R=301]

 

That does stick a ? in the URL. The alternative is doing the redirection in index.php itself (like right at the top).

if ($_SERVER["QUERY_STRING"] == "act=ecommerce&cat=5175&id=ERR&sort=price") {
    header("Location: http://www.bmeteor.co.il/");
    exit;
}

 

By the way, you know the full name isn't necessary if it's your site? Including the [R] flag is enough to make it redirect.

RewriteRule ^index.php$ /? [L,R=301]

header("Location: /");

Link to comment
Share on other sites

Unless you put a query string in the substitution URL, mod_rewrite will keep the original. Apache 2.4 has a flag to disable that but it's so new I doubt you have it.

RewriteRule ^index.php$ http://www.bmeteor.co.il/? [L,R=301]

 

That does stick a ? in the URL. The alternative is doing the redirection in index.php itself (like right at the top).

<?php

if ($_SERVER["QUERY_STRING"] == "act=ecommerce&cat=5175&id=ERR&sort=price") {
    header("Location: http://www.bmeteor.co.il/");
    exit;
}

 

By the way, you know the full name isn't necessary if it's your site? Including the [R] flag is enough to make it redirect.

RewriteRule ^index.php$ /? [L,R=301]

header("Location: /");

 

sorry, but again-there's a problem

this one actually works: RewriteRule ^index.php$ http://www.bmeteor.co.il/? [L,R=301]

The problem is that it redirects every page on the site (no matter what page) to the homepage

I only want this page (or other pages with parameters) to have the redirection

I also tried to use the redirection on the index.php file -and it doesn't work

PS-if it's possible, I prefer to have the redirect through the HTACESS file

thanks

 

Link to comment
Share on other sites

Did you remove the RewriteCond? Because it has to be there.

 

If you're asking about the index.php-I'm not sure exactly where to implement the code

haven't worked out with the HTACESS as well

this is the index.php, maybe you can tell me where exactly to implement this

thanks

 

<?php
/**
* @version		$Id: index.php 14401 2010-01-26 14:10:00Z louis $
* @package		Joomla
* @copyright	Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
* @license		GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/

// Set flag that this is a parent file
define( '_JEXEC', 1 );

define('JPATH_BASE', dirname(__FILE__) );

define( 'DS', DIRECTORY_SEPARATOR );

require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );

JDEBUG ? $_PROFILER->mark( 'afterLoad' ) : null;

/**
* CREATE THE APPLICATION
*
* NOTE :
*/
$mainframe =& JFactory::getApplication('site');

/**
* INITIALISE THE APPLICATION
*
* NOTE :
*/
// set the language
$mainframe->initialise();

JPluginHelper::importPlugin('system');

// trigger the onAfterInitialise events
JDEBUG ? $_PROFILER->mark('afterInitialise') : null;
$mainframe->triggerEvent('onAfterInitialise');

/**
* ROUTE THE APPLICATION
*
* NOTE :
*/
$mainframe->route();

// authorization
$Itemid = JRequest::getInt( 'Itemid');
$mainframe->authorize($Itemid);

// trigger the onAfterRoute events
JDEBUG ? $_PROFILER->mark('afterRoute') : null;
$mainframe->triggerEvent('onAfterRoute');

/**
* DISPATCH THE APPLICATION
*
* NOTE :
*/
$option = JRequest::getCmd('option');
$mainframe->dispatch($option);

// trigger the onAfterDispatch events
JDEBUG ? $_PROFILER->mark('afterDispatch') : null;
$mainframe->triggerEvent('onAfterDispatch');

/**
* RENDER  THE APPLICATION
*
* NOTE :
*/
$mainframe->render();

// trigger the onAfterRender events
JDEBUG ? $_PROFILER->mark('afterRender') : null;
$mainframe->triggerEvent('onAfterRender');

/**
* RETURN THE RESPONSE
*/
echo JResponse::toString($mainframe->getCfg('gzip'));

 

 

Link to comment
Share on other sites

What's your .htaccess right now?

 

RewriteEngine On

RewriteCond %{HTTP_HOST} ^bmeteor\.co\.il [NC]
RewriteRule ^(.*)$ http://www.bmeteor.co.il/$1 [R=301,NC,L]
Options +FollowSymLinks
DirectoryIndex index.php

RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://www.bmeteor.co.il/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

 

thanks

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.