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]
質問
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]