0

I have this rewrite rule in my .htaccess file:

RewriteRule ^home\/([a-z]+)\/([0-9]+)$ /?filter=$1&start=$2 [L]

Although this rule is correct, the only way to make it work (i.e: not show a 404 error), is by disabling SEF plugin.

My question is: Is there a way to add some rewrite rules, when SEF plugin is activated (because I need it)?

P.S: These url params are used to filter data shown on a k2 module (mod_k2_content).

Hakim
  • 3,225
  • 5
  • 37
  • 75
  • I guess it should be possible but then you have to be aware that all the parameters are passed correctly. What do you try to redirect? Articles, extensions? – Laoneo Feb 25 '14 at 08:42
  • I have two `_GET` params that I pass to url, but I want to beautify my url by translating it from`?param1=val1&parm2=val2` to `/val1/val2`. – Hakim Feb 25 '14 at 09:12
  • Why do you not adapt the router then? Are this params for a component or article? Because this should be handled by the router of the extensions and not you :-) – Laoneo Feb 25 '14 at 09:59
  • @Laoneo because I've been using `Joomla 2.5` for only one month, so I'm a noob. Any tutorial on how to use routes to achieve what I want to do? To answer your question, these params are for `mod_k2_content` (a `k2` module). They are used to filter the content shown. – Hakim Feb 25 '14 at 10:16
  • What for params are you passing to K2? Please update your question with the K2 relevant information, perhaps somebody with more K2 knowledge can help you out better. Or ask directly in the K2 forum http://getk2.org/community – Laoneo Feb 25 '14 at 10:30
  • I'm passing theses params to a template module (not to k2). Inside this custom module there is an sql query to filter articles shown on this module. – Hakim Feb 25 '14 at 10:37
  • But then your question is not 100% correct because you depend not on mod_k2_content. I've updated my answer because you need to modify the Joomla router. – Laoneo Feb 25 '14 at 13:12

1 Answers1

1

K2 supports Joomla routing as they have a router. To understand how routing in general works check out the documentation here http://docs.joomla.org/Supporting_SEF_URLs_in_your_component. You have to figure out how the url is built as K2 needs them in special order to make the lookup correctly. BUT routing does only work for components, you are talking about a module, don't know if it will work then too.

[UPDATE: As it looks like that the module is custom and relies on _GET variables]

Then you have make your own System plugin to modify the router. Documentation can be found here: http://docs.joomla.org/J2.5:Creating_a_System_Plugin_to_augment_JRouter

Laoneo
  • 1,546
  • 1
  • 18
  • 25
  • Thanks a lot for links. But do I have to pass my `url params`: `filter` & `start` to the `vars` array that is returned in the `augmentRoute` function? – Hakim Feb 25 '14 at 13:21
  • I think you have to replace them as k2 breaks because you add some more invalid parameters which are breaking the router. – Laoneo Feb 25 '14 at 13:35
  • is there a way to `augment` it instead of `replacing` it? btw Ive never created a plugin. – Hakim Feb 25 '14 at 13:45