This is my first question here in stackoverflow. This website really helped me a lot in terms of web development using Drupal, Joomla, WordPress, javascript, HTML, JQuery and a lot more in the world of web development. Thanks and many thanks!
I’ve also searched this site which is also related to the title of this question but honestly, none of them answers directly my question. I really was struggling for days trying to work this one out but I never really got the correct solution.
So here is my problem. I’ve been trying to redirect these non-existing URL’s in my Joomla site using .htaccess but I couldn’t make it right. Can any of you suggest how should this be done in the .htaccess?
http://www.mysite.com/index.php/component/content/37-2009-10-15-19-28-33?format=feed&type=rss
should redirect to
http://www.mysite.com/index.php/paving-horizontal-concrete/park/34?format=feed&type=atom
should redirect to
http://www.mysite.com/index.php/paving-horizontal-concrete/park
http://www.mysite.com/index.php/component/content/56?layout=blog&format=feed&type=rss
should redirect to
I tried what was suggested here but still unsuccessful.
Any help is greatly appreciated! Thank you in advance!
If you want to remove the final part of the URL path and use a permanent external redirect, try:
But as i noted in my comment, you won’t be able to recover the final part or the query string later.
Edit: If you want to keep the query string, simply add the
[QSA]flag:Alternatively, you can use an internal redirect by removing the
[R]flag. Then you’ll find the original URL in environment variablesREQUEST_URI(including the query string) orREDIRECT_URL(excluding the query string).