Forum Moderators: phranque

Message Too Old, No Replies

301 redirect/rewrite using index.php in joomla

         

jonias

8:34 pm on Jan 14, 2009 (gmt 0)

10+ Year Member



I'm not sure what's happening here but I'm hoping someone can send me in the right direction. I am using the joomla CMS and there is some proprietary stuff in the htaccess in order for mod_rewrite to play nice with joomla.

The problem is I have just updated versions and need to preserve some URLs but Joomla is not allowing any standard 301 redirects to work.

This does not work for some reason:


RewriteRule ^index.php?Itemid=16&id=42&option=com_content&task=view(.*)$ http://www.domain.com/tutorials [L,R=301]

but this (sort of) does:

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?option=com_content&task=view&id=226\ HTTP/
RewriteRule ^index\.php$ http://www.example.com/tutorials/226-joomla-15-template-tutorial/ [R=301,L]

the problem is the code above rewrites the URL like so:

http://www.example.com/tutorials/226-joomla-15-template-tutorial/?option=com_content&task=view&id=226

Is there any way I can remove the last segment from the URL?
"?option=com_content&task=view&id=226"

[edited by: jdMorgan at 9:04 pm (utc) on Jan. 14, 2009]
[edit reason] Pleas use example.com only [/edit]

Caterham

8:56 pm on Jan 14, 2009 (gmt 0)

10+ Year Member



[httpd.apache.org ]:

When you want to erase an existing query string, end the substitution string with just a question mark.

jonias

9:16 pm on Jan 14, 2009 (gmt 0)

10+ Year Member



Hey thanks! I really appreciate the reply.
I read that but I guess it just didn't sink in at fist glance.

Caterham

9:40 pm on Jan 14, 2009 (gmt 0)

10+ Year Member



It should read

.......http://www.example.com/tutorials/226-joomla-15-template-tutorial/[b]?[/b] [R=301,L] 

jonias

9:50 pm on Jan 14, 2009 (gmt 0)

10+ Year Member



Yes, it works. I was talking about the doc link you posted :)
Thanks for your help.