The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Dynamic IP Address Configuration, Dynamic IP Address Handling in .htaccess file
SBH
post Jul 15 2015, 01:27 AM
Post #1


Member
***

Group: Members
Posts: 82
Joined: 6-February 15
Member No.: 22,158



Two questions:

a) If I upload a html file such as default.html or index.html into CPanel, how'd I ensure that the landing page for my website www.abcdef.com is www.abcdef.com/index.html? Tried using answers elsewhere in the web (including editing the .htaccess), but to no avail.

b) Does anyone have a code that'd pick up the IP address, which my machine is being dynamically allotted by the ISP for access control in the .htaccess file? Thanks.

Regards,
SBH
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Jul 15 2015, 05:23 AM
Post #2


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,716
Joined: 9-August 06
Member No.: 6



QUOTE(SBH @ Jul 15 2015, 08:27 AM) *

a) If I upload a html file such as default.html or index.html into CPanel, how'd I ensure that the landing page for my website www.abcdef.com is www.abcdef.com/index.html? Tried using answers elsewhere in the web (including editing the .htaccess), but to no avail.


What the default page for a directory is is a matter of server configuration. If your server is configured to use index.html it will, no matter what other files you upload. You can control this yourself through your .htaccess file.

QUOTE
b) Does anyone have a code that'd pick up the IP address, which my machine is being dynamically allotted by the ISP for access control in the .htaccess file? Thanks.


Your own computer? If you are on Windows bring up a prompt, type the below and hit enter.
CODE
ipconfig /all


You'll get a list of things. Looks for IP address or IP4 address. If you use a router though this will be your private, internal IP that's used only in your local network. To get your public IP, the one that's presented to the outside world, you need to log in to your routers CP. Or, more easily, go to some site that tells you what IP you've got (or run your own script on your server).

Here's one such page.
https://www.whatismyip.com/
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Jul 15 2015, 06:22 AM
Post #3


.
********

Group: WDG Moderators
Posts: 9,628
Joined: 10-August 06
Member No.: 7



QUOTE(SBH @ Jul 15 2015, 08:27 AM) *

a) If I upload a html file such as default.html or index.html into CPanel, how'd I ensure that the landing page for my website www.abcdef.com is www.abcdef.com/index.html? Tried using answers elsewhere in the web (including editing the .htaccess), but to no avail.

Do you mean you want to display index.html when the URL www.abcdef.com/ is requested? In that case the Apache DirectoryIndex directive might be used:
http://bignosebird.com/apache/a2.shtml
http://httpd.apache.org/docs/2.4/mod/mod_d...#directoryindex

Note that www.abcdef.com/ and www.abcdef.com/index.html will then display the same content, which might confuse users' browsing history.

QUOTE
b) Does anyone have a code that'd pick up the IP address, which my machine is being dynamically allotted by the ISP for access control in the .htaccess file?

Not sure I understood this. Do you want to limit access control to only your own IP? In that case I don't know how to do it if the IP is dynamic. unsure.gif

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
SBH
post Jul 16 2015, 11:27 AM
Post #4


Member
***

Group: Members
Posts: 82
Joined: 6-February 15
Member No.: 22,158



Thanks Pandy & Christian J.

For the first question, yes Pandy, I know I gotta override using .htaccess, but am facing strange issues. Should I discontinue with order/allow/deny commands & instead switch over to 'Require'?

2nd question - yes Christian, you nailed it right. I need a way to see if my .htaccess or any other config file or mechanism can automatically detect my (dynamic) IP address & allow only my machine to access the website.

Thanks again to both of you.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Jul 16 2015, 02:28 PM
Post #5


.
********

Group: WDG Moderators
Posts: 9,628
Joined: 10-August 06
Member No.: 7



QUOTE(SBH @ Jul 16 2015, 06:27 PM) *

For the first question, yes Pandy, I know I gotta override using .htaccess, but am facing strange issues. Should I discontinue with order/allow/deny commands & instead switch over to 'Require'?

That doesn't sounds like .htaccess directives. unsure.gif Which web server do you use?

QUOTE
2nd question - yes Christian, you nailed it right. I need a way to see if my .htaccess or any other config file or mechanism can automatically detect my (dynamic) IP address & allow only my machine to access the website.

You can easily get any visitor's IP with e.g. PHP. The hard part is how make the server know that the IP belongs to you.

Why not use HTTP authentication or some other password protection (on the server) instead?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Jul 16 2015, 05:24 PM
Post #6


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,716
Joined: 9-August 06
Member No.: 6



QUOTE(SBH @ Jul 16 2015, 06:27 PM) *

For the first question, yes Pandy, I know I gotta override using .htaccess, but am facing strange issues. Should I discontinue with order/allow/deny commands & instead switch over to 'Require'?


What are those issues and what is the original problem that you try to solve? Is the wrong index file served or what?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
SBH
post Jul 22 2015, 06:21 AM
Post #7


Member
***

Group: Members
Posts: 82
Joined: 6-February 15
Member No.: 22,158



QUOTE(Christian J @ Jul 16 2015, 02:28 PM) *

QUOTE(SBH @ Jul 16 2015, 06:27 PM) *

For the first question, yes Pandy, I know I gotta override using .htaccess, but am facing strange issues. Should I discontinue with order/allow/deny commands & instead switch over to 'Require'?

That doesn't sounds like .htaccess directives. unsure.gif Which web server do you use?

QUOTE
2nd question - yes Christian, you nailed it right. I need a way to see if my .htaccess or any other config file or mechanism can automatically detect my (dynamic) IP address & allow only my machine to access the website.

You can easily get any visitor's IP with e.g. PHP. The hard part is how make the server know that the IP belongs to you.

Why not use HTTP authentication or some other password protection (on the server) instead?

Hi,

First of all apologies for staying away from the forum for the past few days. To respond to your questions, isn't "Order Allow, Deny" a .htaccess directive? Unless I'm missing/misunderstanding you.
As for the IP, I need a way for the server to decipher the IP, even if it is dynamic. Most places in the web say that you got to install something like DynDNS to capture dynamic IP addresses? Are you saying otherwise?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
SBH
post Jul 22 2015, 06:36 AM
Post #8


Member
***

Group: Members
Posts: 82
Joined: 6-February 15
Member No.: 22,158



QUOTE(pandy @ Jul 16 2015, 05:24 PM) *

QUOTE(SBH @ Jul 16 2015, 06:27 PM) *

For the first question, yes Pandy, I know I gotta override using .htaccess, but am facing strange issues. Should I discontinue with order/allow/deny commands & instead switch over to 'Require'?


What are those issues and what is the original problem that you try to solve? Is the wrong index file served or what?

Issues are because a new IP address is allotted to me by my ISP and hence, need a way for the .htaccess file to pick that up.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Jul 22 2015, 08:38 AM
Post #9


.
********

Group: WDG Moderators
Posts: 9,628
Joined: 10-August 06
Member No.: 7



QUOTE(SBH @ Jul 22 2015, 01:21 PM) *

To respond to your questions, isn't "Order Allow, Deny" a .htaccess directive? Unless I'm missing/misunderstanding you.

You're right, but it's used for access control, not for specifying directory default files (use DirectoryIndex for that).

QUOTE
Most places in the web say that you got to install something like DynDNS to capture dynamic IP addresses? Are you saying otherwise?

Dynamic DNS seems to be used for mapping a domain name to a web server that uses a dynamic IP, is that what you want? If so I misunderstood you, I thought you wanted to use your browser's dynamic IP to identify yourself to the web server (instead of using e.g. a password). If you really mean the latter I have no idea if dynamic DNS can be used for that, or if it's secure/reliable.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 19th March 2024 - 02:30 AM