Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Perhaps a strange question, but I have a website that's not ready for production use online in order to test paypal payments.

I had locked down the site using a .htaccess file however this also prevented ipn notifications from hitting my ipnlistener which meant i was unable to keep track of payments successfully being made. so I temporarily remove the htaccess file to allow this.

Is there a way to lock a site down with password protection but allow certain scripts to run?

Bit of a noob at this thing

share|improve this question
2  
You use the site in password mode or noindex. You then use PayPal's API in sandbox mode. Have you made a sandbox account? –  bybe Feb 16 at 13:10
    
yep the account is fine and works, however when the site was locked by .htaccess user/password the paypal ipn send bombed out as it required a user/password to call the listener. I unlocked the site during the testing phase but thought perhaps there's a better way of doing things to keep htaccess authentication but allow paypal –  sapatos Feb 17 at 1:46
    
btw - what do you mean by using a site in password mode (I found noindex easy enough for robots) –  sapatos Feb 17 at 1:47
    
You should be able to tell PayPal the password to your site. When running in Sandbox mode. –  bybe Feb 18 at 10:09
    
Thansk I'll check on that –  sapatos Feb 19 at 21:44

1 Answer 1

Rather than using HTTP Authentication with usernames/passwords, you might use IP address white-listing with the following .htaccess code (enter your own public IP address for testing on line 6 instead of 123.123.123.123):

# Block every connection by default, exceptions follow below
Order deny,allow  
Deny from all 

# Allow from Your Testing Public IP (123.123.123.123)
Allow from 123.123.123.123

# Allow from PayPal Sandbox (direct)
Allow from 173.0.82.78
Allow from 173.0.82.83
Allow from 173.0.82.89
Allow from 173.0.82.66

# Allow from PayPal Sandbox (via Akamai routing technology)
Allow from 23.43.11.39
Allow from 23.43.11.42
Allow from 23.43.11.41
Allow from 23.43.11.40
Allow from 23.37.43.39
Allow from 23.37.43.42
Allow from 23.37.43.41
Allow from 23.37.43.40
Allow from 23.44.91.39
Allow from 23.44.91.42
Allow from 23.44.91.41
Allow from 23.44.91.40
Allow from 23.42.27.39
Allow from 23.42.27.42
Allow from 23.42.27.41
Allow from 23.42.27.40
Allow from 23.43.155.39
Allow from 23.43.155.42
Allow from 23.43.155.41
Allow from 23.43.155.40
Allow from 23.9.91.39
Allow from 23.9.91.42
Allow from 23.9.91.41
Allow from 23.9.91.40
Allow from 23.46.123.39
Allow from 23.46.123.42
Allow from 23.46.123.41
Allow from 23.46.123.40
Allow from 23.38.27.39
Allow from 23.38.27.42
Allow from 23.38.27.41
Allow from 23.38.27.40
Allow from 23.50.187.39
Allow from 23.50.187.42
Allow from 23.50.187.41
Allow from 23.50.187.40
Allow from 23.50.91.39
Allow from 23.50.91.42
Allow from 23.50.91.41
Allow from 23.50.91.40
Allow from 23.35.171.39
Allow from 23.35.171.42
Allow from 23.35.171.41
Allow from 23.35.171.40
Allow from 23.51.43.39
Allow from 23.51.43.42
Allow from 23.51.43.41
Allow from 23.51.43.40
Allow from 23.54.107.39
Allow from 23.54.107.42
Allow from 23.54.107.41
Allow from 23.54.107.40
Allow from 23.52.155.39
Allow from 23.52.155.42
Allow from 23.52.155.41
Allow from 23.52.155.40
Allow from 23.35.107.39
Allow from 23.35.107.42
Allow from 23.35.107.41
Allow from 23.35.107.40
Allow from 23.37.139.39
Allow from 23.37.139.42
Allow from 23.37.139.41
Allow from 23.37.139.40
Allow from 23.74.19.39
Allow from 23.74.19.42
Allow from 23.74.19.41
Allow from 23.74.19.40
Allow from 23.53.107.39
Allow from 23.53.107.42
Allow from 23.53.107.41
Allow from 23.53.107.40
Allow from 23.5.75.39
Allow from 23.5.75.42
Allow from 23.5.75.41
Allow from 23.5.75.40
Allow from 23.35.43.39
Allow from 23.35.43.42
Allow from 23.35.43.41
Allow from 23.35.43.40
Allow from 23.4.59.39
Allow from 23.4.59.42
Allow from 23.4.59.41
Allow from 23.4.59.40
Allow from 23.46.107.39
Allow from 23.46.107.42
Allow from 23.46.107.41
Allow from 23.46.107.40
Allow from 23.53.155.39
Allow from 23.53.155.42
Allow from 23.53.155.41
Allow from 23.53.155.40
Allow from 23.44.251.39
Allow from 23.44.251.42
Allow from 23.44.251.41
Allow from 23.44.251.40
Allow from 23.43.75.39
Allow from 23.43.75.42
Allow from 23.43.75.41
Allow from 23.43.75.40
Allow from 23.41.75.39
Allow from 23.41.75.42
Allow from 23.41.75.41
Allow from 23.41.75.40
Allow from 23.51.27.39
Allow from 23.51.27.42
Allow from 23.51.27.41
Allow from 23.51.27.40
Allow from 23.5.251.39
Allow from 23.5.251.42
Allow from 23.5.251.41
Allow from 23.5.251.40
Allow from 23.37.187.39
Allow from 23.37.187.42
Allow from 23.37.187.41
Allow from 23.37.187.40
Allow from 23.4.43.39
Allow from 23.4.43.42
Allow from 23.4.43.41
Allow from 23.4.43.40
Allow from 23.50.75.39
Allow from 23.50.75.42
Allow from 23.50.75.41
Allow from 23.50.75.40
Allow from 23.34.235.39
Allow from 23.34.235.42
Allow from 23.34.235.41
Allow from 23.34.235.40
Allow from 23.50.203.39
Allow from 23.50.203.42
Allow from 23.50.203.41
Allow from 23.50.203.40

IP address list courtesy of PayPal Technical Support's IP Addresses for Sandbox PayPal servers page, last updated on 23rd-Jan-2014.

Any IP address connecting in that is not white-listed would receive an HTTP 403 Forbidden response. Since this includes search engines, your site shouldn't get indexed prior to official launch.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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