Showing posts with label redirection. Show all posts
Showing posts with label redirection. Show all posts

Thursday, 3 December 2015

how to redirect http to https or vice versa through htaccess

To redirect the site from http to htttps just use the below code in the top of htaccess file


for htttps to http


RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]


for http to https 

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

 

 



Thursday, 7 May 2015

How to redirect to referrer from Observer in Magento ?

we can redirect to the referrer from magento observer like below


Mage::getSingleton('core/session')->addError('your error message'); // to show your message after redirection
$url = Mage::helper('core/http')->getHttpReferer() ? Mage::helper('core/http')->getHttpReferer()  : Mage::getUrl();
Mage::app()->getFrontController()->getResponse()->setRedirect($url);
Mage::app()->getResponse()->sendResponse();
exit ;