I have a contact form, which I'm showing from CMS page. Like described at method:
http://inchoo.net/ecommerce/magento/contact-form-in-magento/
CMS page url is: customer-service-contact
. I also redefined standard Mage_Contacts
module. Now I need when somebody opens:
http://{website}/customer-service-contact/
he should be redirected to:
https://{website}/customer-service-contact/
I know about trick at xml:
<frontend>
<secure_url>
<contacts>/contacts/</contacts>
</secure_url>
</frontend>
But if I change it to url customer-service-contact
, it's not working.
How to implements this?
Best Answer
The
https
redirection does not work for cms pages because theRouter
that matches the cms pages (Mage_Cms_Controller_Router
) does not check if some page should be secure.Here is a little workaround to achieve this. It involves changing the router for the cms pages.
You will have to create a module. Let's call it
Easylife_Secure
:For this you will need the following files:
app/etc/modules/Easylife_Secure.xml
- the declaration fileapp/code/local/Easylife/Secure/Controller/Router.php
- your new routerThe method
match
is the same as the one in the cms router, it just has one line that checks if the path should be secure. The rest of the methods are copied from the standard router.app/code/local/Easylife/Secure/etc/config.xml
- the configuration fileClear the cache and you are done.
[EDIT]
This small extension works for the general case, for all cms pages, I added it here for 'posterity', but I agree with Alex on this. For your specific case, you should use the standard contacts page and customize its template or with additional blocks