문제

Pl advise

Pl advise, how to add Itemid=13 on end of all url matching by making 301 redirect

index.php?option=com_usedtoy&view=post&id=**variable**

For ex Incorrect URL

 www.abc.com/index.php?option=com_usedtoy&view=post&id=495
 www.abc.com/index.php?option=com_usedtoy&view=post&id=497
 www.abc.com/index.php?option=com_usedtoy&view=post&id=510

Correct URL

 www.abc.com/index.php?option=com_usedtoy&view=post&id=495&Itemid=13
 www.abc.com/index.php?option=com_usedtoy&view=post&id=497&Itemid=13
 www.abc.com/index.php?option=com_usedtoy&view=post&id=510&Itemid=13

HTACCESS CODE TRYING

 RewriteEngine On
 RewriteCond %{QUERY_STRING} (^|&)option=com_usedtoy(&|$) [NC]
 RewriteCond %{QUERY_STRING} !(^|&)Itemid=13(&|$) [NC]
 RewriteRule ^index\.php$ %{REQUEST_URI}/%{QUERY_STRING} [L,NC]
 RewriteRule ^(index\.php)/(option=com_usedtoy&view=post)&(^id=.*)&((?!Itemid=13&).+)$ /$1?$2&Itemid=13&$3 [L,NC,R=301]
도움이 되었습니까?

해결책

Try this rule:

 RewriteEngine On

 RewriteCond %{QUERY_STRING} (^|&)option=com_usedtoy(&|$) [NC]
 RewriteCond %{QUERY_STRING} !(^|&)Itemid=13(&|$) [NC]
 RewriteRule ^index\.php$ %{REQUEST_URI}?%{QUERY_STRING}&Itemid=13 [L,NC,R=301]
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top