你好,我有这个问题
我无法将此index.php?option=com_adsmanager&view=list&catid=8&Itemid=435重定向到此index.php?option=com_adsmanager&view=list&catid=8&Itemid=565
catid=8是一个变量,我需要重定向所有的catid=值
即时通信Im只需要将&Itemid=435转换到&Itemid=565
我有这个代码
RewriteEngine on
RedirectMatch 301 ^(.+)\&Itemid=435$ $1&Itemid=565我不知道出了什么问题,我需要所有的urls anything&Itemid=435去sameanything&Itemid=565
发布于 2012-09-08 07:22:59
替代
在index.php或Joomla的configuration.php的顶部添加下面的PHP Code!
它检查数字catid & Itemid请求&如果是Itemid=435,它将用catid和新的Itemid重定向URL。请根据您的需要随意修改代码!
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);
}答案- 2
我假设您想要的是将URI-1重定向到URI-2。
下面的mod_rewrite将允许您将specific URI重定向到其他specific URI。只需在.htaccess文件中添加以下规则即可。
<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>答案- 3
如果您想使用'/index.php'和'/'处理请求,请在您的.htaccess中使用下面的代码。
<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>注意:请勿在单个 .htaccess 文件中同时使用这两个代码。
https://stackoverflow.com/questions/12326212
复制相似问题