How to remove certain strings in a non-existing URL and redirect it to another URL using .htaccess in Joomla -
How to remove certain strings in a non-existing URL and redirect it to another URL using .htaccess in Joomla -
this first question here in stackoverflow. website helped me lot in terms of web development using drupal, joomla, wordpress, javascript, html, jquery , lot more in world of web development. , many thanks!
i've searched site related title of question honestly, none of them answers straight question. struggling days trying work 1 out never got right solution.
so here problem. i've been trying redirect these non-existing url's in joomla site using .htaccess
couldn't create right. can of suggest how should done in .htaccess
?
www.mysite.com/index.php/component/content/37-2009-10-15-19-28-33?format=feed&type=rss
should redirect
www.mysite.com/index.php/component/content
www.mysite.com/index.php/paving-horizontal-concrete/park/34?format=feed&type=atom
should redirect to
www.mysite.com/index.php/paving-horizontal-concrete/park
www.mysite.com/index.php/component/content/56?layout=blog&format=feed&type=rss
should redirect to
www.mysite.com/index.php/component/content/
i tried suggested here still unsuccessful.
any help appreciated! give thanks in advance!
if want remove final part of url path , utilize permanent external redirect, try:
rewriteengine on rewritebase / rewriterule ^(index\.php/[^/]+/[^/]+)/ $1 [r=301,l]
but noted in comment, won't able recover final part or query string later.
edit: if want maintain query string, add together [qsa]
flag:
rewriterule ^(index\.php/[^/]+/[^/]+)/ $1 [r=301,l,qsa]
alternatively, can utilize internal redirect removing [r]
flag. you'll find original url in environment variables request_uri
(including query string) or redirect_url
(excluding query string).
.htaccess url redirect
Comments
Post a Comment