April 14, 201115 yr Hi Guys, I'm trying to perform the following single redirect: http://www.site.co.uk/index.php?option=com_content&view=section&layout=blog&id=3&Itemid=9&limitstart=15 301 redirect to: http://www.site.co.uk I've been researching this and have tried the following: RewriteCond %{QUERY_STRING} ^option=com_content&view=section&layout=blog&id=3&Itemid=9&limitstart=15$ RewriteRule ^index\.php$ http://www.site.co.uk/ [L,R=301] But this results in: http://www.site.co.uk/?option=com_content&view=section&layout=blog&id=3&Itemid=9&limitstart=15 Any advice would be appreciated Edited April 14, 201115 yr by wkdfx
April 14, 201115 yr I find PHP to be a lot easier when it comes to simple things like this. Why not just use your index.php, and at the top put if(!empty($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] == 'option=com_content&view=section&layout=blog&id=3&Itemid=9&limitstart=15') { header('Location: http://www.site.co.uk/'); die(); }
April 14, 201115 yr Hi Guys, I'm trying to perform the following single redirect: http://www.site.co.uk/index.php?option=com_content&view=section&layout=blog&id=3&Itemid=9&limitstart=15 301 redirect to: http://www.site.co.uk I've been researching this and have tried the following: RewriteCond %{QUERY_STRING} ^option=com_content&view=section&layout=blog&id=3&Itemid=9&limitstart=15$ RewriteRule ^index\.php$ http://www.site.co.uk/ [L,R=301] But this results in: http://www.site.co.uk/?option=com_content&view=section&layout=blog&id=3&Itemid=9&limitstart=15 Any advice would be appreciated Just add this line to your .htaccess: redirect 301 /index.php?option=com_content&view=section&layout=blog&id=3&Itemid=9&limitstart=15 http://www.site.co.uk/ Edited April 14, 201115 yr by Spitfire
April 14, 201115 yr Author I find PHP to be a lot easier when it comes to simple things like this. Why not just use your index.php, and at the top put if(!empty($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] == 'option=com_content&view=section&layout=blog&id=3&Itemid=9&limitstart=15') { header('Location: http://www.site.co.uk/'); die(); } Thanks Jay, this worked well! I checked to see the type of redirect and it was a 302 so after a little research included the following line which did the trick: header('HTTP/1.1 301 Moved Permanently'); I'm still interested to see how it would be done through htaccess if anyone has any ideas? Edited April 14, 201115 yr by wkdfx
April 14, 201115 yr Author Just add this line to your .htaccess: redirect 301 /index.php?option=com_content&view=section&layout=blog&id=3&Itemid=9&limitstart=15 http://www.site.co.uk/ Unfortunately this won't work as the URL contains variables
Create an account or sign in to comment