cancel
Showing results for 
Search instead for 
Did you mean: 

use http referer

SOLVED

use http referer

Hi,

 

I am not sure if this was possible.  I want to sell items in my magenta store but only allow access to the store if the traffic has come from a referring domain.  I know that this is not full proof using http_referer but it will comply then with the brands conditions and mean that the store cannot be browsed directly.  This needs to be more than just hiding the prices it also needs to hide the products.

 

I was initially thinking added a .htaccess file and if the domain referer is not correct then divert them to an error page, but wondered if there was an area I could add php to the top of the pages which will perform the redirects for me?  

 

Or better still if there is another option to achieve what I am aiming for.  

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

Re: use http referer

Ok, let me guide you with this.

You can add your php code in Magento theme files.

Here are some suggestions:

  1. Magento Header - for all page
  2. Magento Footer - for all page
  3. Magento Product Page - only for product view page
  4. Magento Category Page - only for all category page.

You can choose options according to your requirements. If you are still confused then tell me the link which you share on another site with parameter.
Generally, the link for the Product Page or Homepage.

Was my answer helpful? You can accept it as a solution.
175+ Professional Extensions for M1 & M2
Need a developer?Just visit Contact Us Now

View solution in original post

3 REPLIES 3

Re: use http referer

Hi @Stupendous

 

For your requirements you need to do something like this:

  1. Pass one parameter with the URL in the reference link which you have given in other places
  2. When the link is being opened at that time, you need to check if that parameter is available or not
  3. If parameter is not available then open the link otherwise redirect to error page.

Hope that helps. Let me know if it doesn't.

Was my answer helpful? You can accept it as a solution.
175+ Professional Extensions for M1 & M2
Need a developer?Just visit Contact Us Now

Re: use http referer

Yeo this makes perfect sense, I know the php to check and perform the redirect but not sure where I add this php on the Magento admin or files? I know I should not touch core files?

Re: use http referer

Ok, let me guide you with this.

You can add your php code in Magento theme files.

Here are some suggestions:

  1. Magento Header - for all page
  2. Magento Footer - for all page
  3. Magento Product Page - only for product view page
  4. Magento Category Page - only for all category page.

You can choose options according to your requirements. If you are still confused then tell me the link which you share on another site with parameter.
Generally, the link for the Product Page or Homepage.

Was my answer helpful? You can accept it as a solution.
175+ Professional Extensions for M1 & M2
Need a developer?Just visit Contact Us Now