How to replace only a part of url using htaccess?

I need to modify a generated joomla url to another and htaccess seems like a nice way to do this. It's just that I'm not too familiar with it :/

I need to make this url:

http://www.site.com/component/uddeim/?task=new&recip=190&nouserlist=141

Rewritten into this url:

http://www.site.com/community/messages?task=new&recip=190&nouserlist=141

?task=new&recip=190&nouserlist=141 << the number values are dynamic, meaning they change

anyone can help? Thank you...

Upvotes: 1

Views: 3834

Answers (1)

Michael Berkowski
Michael Berkowski

Reputation: 270637

Assuming you mean that your end users will enter /component/uddeim/?... into their browsers, use:

RewriteEngine On
RewriteRule ^component/uddeim/? http://example.com/community/messages [L,QSA,R=301]

The QSA flag indicates that the original query string should be appended to the new URL, preserving it in whatever for it may be in.

Upvotes: 2

Related Questions