0

I want to rewrite /custom link from /catalogsearch/result/?q=some&attr=value for this I have added below code in my module config.xml

...
<rewrite>
    <mymodule>
        <from><![CDATA[/custom/]]></from>
        <to><![CDATA[catalogsearch/result/index/q/some/attr/value/$1]]></to>
        <complete>1</complete>
    </mymodule>
</rewrite>
...

From above code url /custom showing content of search page, but the other url including custom also rewritten from above code. for example /custom-page or custom-page1.

How to rewrite exact url?

1

To override the Catalog Search controller,

I request you to use below method instead of old frontend:

<config>
  <frontend>
    <routers>
       <catalogsearch>
          <args>
            <modules>
              <yournamespace_module before="Mage_CatalogSearch">Yournamespace_Module</yournamespace_module>
            </modules>
          </args>
       </catalogsearch>
    </routers>
  </frontend>
</config>

It will redirect every request with your custom one.

hope this will work for you.

  • Please check my question first I don't want to overwrite controller or don't want to change any functionality, I have a cms page "/custom" and want to get same content from the mentioned url on my page. – Vinaya Maheshwari Dec 19 '17 at 13:36
  • if it is CMS page so you can call catalog search blocks in layout xml updates – liyakat Dec 19 '17 at 14:31
  • please post regarding xml. – Vinaya Maheshwari Dec 20 '17 at 4:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.