Blocking Public from Uploaded Site

Not sure how to ask this question… :confused:

I need to upload my client’s website from “development” to “production”, and I need to keep the file structure/URL’s exactly as they are in Dev, but I also want to block out the public for the time being!!

(I have never been responsible for uploading a website or managing the web hosting, so pardon if this is a dumb question!!)

You may ask, “What exactly are you trying to do?”

Well, I want to upload my final code-base from Dev to Production and not mess with any of the directory-structure or URL’s because I need the ability to do final testing that what works beautifully in Dev will work beautifully in Production.

But I want end users off the Internet to stay the hell out until I deem things to be ready for “Go Live”!!

Make sense?

There is also the NOT so tiny issue that my client is 2 months behind delivering content that we really need to go live.

So I want to upload everything now, make sure that only I can surf the website on the Internet, and be sure that everything works, and then when my client gives me the missing content and the thumbs up, then ideally I could just make a minor tweak to the advice I hope to get here, and wha-la, my client’s website is “live” and already thoroughly tested for the Internet.

Am I making any sense?


I was thinking maybe something like a .htaccess file would allow me to “password-protect” www.MyClientsWebsite.com so only I can get in for now.

Is this doable?

Thanks!

Try Googling to find What is my IPAdress and make a note of it.

On your live site test for $_SERVER[‘REQUEST_URI’]

If it matches it is you otherwise it is everybody else so display a message and exit.

Tapped from a mobile.

I believe you are referencing PHP, no?

It seems like I would want to follow your logic, but do it in a .htacess file…

In Apache, is there a way to say, "If the IP requesting www.domain.com is < My_IP > then pass through to index.php, otherwise go to “under-construction.php”

Try this:

URL from a quick Google search and not tested.

Tapped laboriously on a mobile.

Beware that your IP address is not permanent and your ISP may change the address numerous times per day.

Or if you access the internet in a public place, such as the Library/Internet Cafe, that you will share a public IP address with everyone in that building.

1 Like

This is on a VPS with a dedicated IP…

Does anyone know how I would do what I want using a .htaccess file?

Yes and that is why anyone can access the remote location.

Did you “Try Googling to find What is my IPAdress and make a note of it.”

Try again today and see if Your IP Address is different to what it was yesterday.

And as @cpradio remarked, try your local library, internet cafe or office and friend’s computers.

A better solution could possibly be to login with a password, failure would result in an “Under Construction” web page.

@John_Betong,

I’m not following anything you are saying…

My MacBook has a static IP and my VPS has a dedicated IP.

Since my IP never changes on my MacBook, it would make sense to make it so if my .htaccess file sees that it is my IP address then it loads index.php, and for everyone else they either get an “Under Construction Page” or an error.

I think that is better done using Apache than PHP.

And I keep asking if that can be done using my .htaccess file - which I’m pretty sure it can.

I have no clue what Internet Cafes have to do with what I am asking for help with?!

Did you try the htaccess scripts in the perishable press link I supplied? At least one example should solve your problem.

off topic
How much extra did it cost for a dedicated IP address. This service is not normally supplied by any ISP. Normally ip addresses change frequently.

1 Like

mikey,

Sorry, this is not as hard as all this makes it seem. When I upload a new website:

a. The domain (and any links within) are not known.

b. My websites are normally .PHP.

c. I simply create a dummy Welcome page with NO links to other pages and upload as index.html and use the Apache core directive.

DirectoryIndex index.html index.php

The “test website” will be “hidden by obfuscation” (i.e., no links so they “don’t exist”) as a “live” website.

Easy Peasy!

Regards,

DK

[quote=“John_Betong, post:10, topic:113379, full:true”]
Did you try the htaccess scripts in the perishable press link I supplied? At least one example should solve your problem.[/quote]

I missed that post before. Sorry.

I have a VPS which came with 2 dedicated IP’s at no additional cost.

Turns out in cPanel there is a way to do this.

cPanel > File Manager > Security > Password Protect Directories

Or this can be done manually by inserting the following in a .htaccess file in the directory you want protected…

AuthType Basic
AuthName "Authentication Required"
AuthUserFile "/path/to/password/file/called/.htpasswd"
Require valid-user

Then you use a password generator and stick a username/password pair in your .htpasswrd file.

I give up, maybe someone else can explain the difference.

What are you not understanding, John?

(Nothing personal, but it sounds like you don’t understand about dynamic vs static IP’s… Or about dedicated IP’s…)

Not sure what you seem so frustrated about? :confused:

Hi @mikey_w,

It believe you request and log on to an internet service provider. The ISP allocates your personal, random IP Address which can be used to access the internet.

Your web hosting stores and hosts data that you upload to their servers and supplies static, public URLs for others to access your data.

1 Like

@John_Betong… I would recommend you Google “VPS” and see what it means, because all of your responses have been nonsensical in this thread…

I disagree. You can’t consider the VPS IP address when you are wanting to block out the public from viewing your website, you have to consider your ISP’s IP address that gets assigned to your internet connection. So with that said, John’s responses make a lot of sense.

2 Likes

There is a difference between the IP of a domain and the IP an ISP uses.

Admittedly confusing with the acronyms being so similar, but different just the same.

I assume from your response that you have not Googled for your IP address and noted any changes.