1

I want to rewrite /catalogsearch/result/index/?q=querystring to a custom url /search/querystring.

For this I have created a custom module and in config.xml added below code :

<global>
        <rewrite>
            <custom_module>
                <from><![CDATA[/search\/(.*)/]]></from>
                <to><![CDATA[catalogsearch/result/index/$1]]></to>
                <complete>1</complete>
            </custom_module>
        </rewrite>
 ...       
</global>

This rewrite code is working and rewrite to /search/?q=querystring. But I want to rewrite to /search/querystring. For this I am trying below code :

<global>
        <rewrite>
            <custom_module>
                <from><![CDATA[/search\/(.*)/]]></from>
                <to><![CDATA[catalogsearch/result/index/?q=$1]]></to>
                <complete>1</complete>
            </custom_module>
        </rewrite>
 ...       
</global>

But this code redirect url /search/querystring to home page.

How to rewrite catalogsearch/result/index/?q= to custom url?

1 Answer 1

0

Finally it is solved, below code is working :

<global>
        <rewrite>
            <custom_module>
                <from><![CDATA[/search\/(.*)/]]></from>
                <to><![CDATA[catalogsearch/result/index/q/$1]]></to>
                <complete>1</complete>
            </custom_module>
        </rewrite>
 ...       
</global> 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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