A simple example of a redirect to a parent category from category without products. Use observer and watching the event core_block_abstract_to_html_before.

Everything that’s needed:

Declare observer in config.xml

    <frontend>
        
        ...
        
        <events>
            <core_block_abstract_to_html_before>
                <observers>
                    <system_block_abstract_to_html_before>
                        <type>singleton</type>
                        <class>YOU EXTENSION NAME/observer</class>
                        <method>redirectToParentCategory</method>
                    </system_block_abstract_to_html_before>
                </observers>
            </core_block_abstract_to_html_before>
        </events>
        
        ...
        
    </frontend>

And add tis methods to ../Models/Observer.php