Jump to content

Recommended Posts

Hi all,

I'm new in here

I was looking for similar threads but haven't found something helpful yet

I've tried to 301 redirect the following url http://www.bmeteor.co.il/index.php?act=ecommerce&cat=5175&id=ERR&sort=price

to the homepage http://www.bmeteor.co.il/

any help would be really aprreciated

thank you in advance  ;)

Link to comment
https://forums.phpfreaks.com/topic/259761-htacess-redirects-with-get-parametrs/
Share on other sites

Drop the leading / from the RewriteRule.

 

nope, that doesn't work

I also tried this one:

RewriteCond %{QUERY_STRING} ^act=ecommerce&cat=5175&id=ERR&sort=price$

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

but it redirects to the same address only without index.php

 

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: /");

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

 

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'));

 

 

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

 

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.