0
votes

Hello I have this issue

I cant redirect this index.php?option=com_adsmanager&view=list&catid=8&Itemid=435 To this index.php?option=com_adsmanager&view=list&catid=8&Itemid=565

catid=8 is a variable i need redirect all the catid= values

Im only need to chanche &Itemid=435 to &Itemid=565

I have this code

   RewriteEngine on
    RedirectMatch 301 ^(.+)\&Itemid=435$ $1&Itemid=565

I dont know what is wrong I need all the urls anything&Itemid=435 goes to sameanything&Itemid=565

1
Another option is do this From: myurl/index.php/variable To: myurl/index.php/clasificados/variableFacundo Lafuente Diaz

1 Answers

0
votes

Alternative

Add below PHP Code at the top of index.php or configuration.php of Joomla!

It checks for numerical catid & Itemid requests & if Itemid=435 It will redirect URL with catid & new Itemid. Feel free to modify code according to your need!

if(isset($_GET['catid']) && is_numeric($_GET['catid']) && isset($_GET['Itemid']) && is_numeric($_GET['Itemid']))        
if($_GET['Itemid'] == 435)
{
    $catid    = $_GET['catid'];
    $location = "/index.php?option=com_adsmanager&view=list&catid=$catid&Itemid=565";
    header ('HTTP/1.1 301 Moved Permanently');
    header ('Location: '. $location);
}

Answer - 2

I assumed that you wants is to redirect URI-1 to URI-2.

  1. index.php?option=com_adsmanager&view=list&catid=8&Itemid=435

  2. index.php?option=com_adsmanager&view=list&catid=8&Itemid=565

Below mod_rewrite will let you redirect specific URI to other specific URI. Just add below rules in .htaccess file.

<IfModule mod_rewrite.c>
 Options +FollowSymlinks
 RewriteEngine on
 RewriteCond %{QUERY_STRING} ^option=com_adsmanager&view=list&catid=8&Itemid=435$
 RewriteRule ^/?index\.php$ /index.php?option=com_adsmanager&view=list&catid=8&Itemid=565 [R=301,L]
</IfModule>

Answer - 3

Use below in your .htaccess, if you want to handle requests with'/index.php' and '/'.

<IfModule mod_rewrite.c>
 Options +FollowSymlinks
 RewriteEngine on
 RewriteCond %{QUERY_STRING} ^option=com_adsmanager&view=list&catid=8&Itemid=435$
 RewriteRule ^(.*)$ /index.php?option=com_adsmanager&view=list&catid=8&Itemid=565 [R=301,L]
</IfModule>

NOTE: Do not use both code in single .htaccess file.