Solved

IP to name base

Posted on 2004-08-08
10
270 Views
Last Modified: 2010-03-04
I installed Apache server. Let say my IP addr is 123.123.123.123
From the browser I can see the pages by typing http://123.123.123.123/test.htm
Is it possible to setup Apache so it will automaticall convert to name based such as
http://uniqueName/test.htm?

Thanks
0
Comment
Question by:helpJavaGuru
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
10 Comments
 
LVL 45

Accepted Solution

by:
sunnycoder earned 65 total points
ID: 11745654
Hi helpJavaGuru,

> Is it possible to setup Apache so it will automaticall convert to name based such as
http://uniqueName/test.htm?
Conversion is DNS functionality ...
To use names instead of IP address, set servername in httpd.conf file

#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If this is not set to valid DNS name for your host, server-generated
# redirections will not work.  See also the UseCanonicalName directive.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
# You will have to access it by its address anyway, and this will make
# redirections work in a sensible way.
#
ServerName uniquename:80

Sunnycoder
0
 

Author Comment

by:helpJavaGuru
ID: 11745757
I already did that before the posting and it didn't work.
I am using Windows xp and I don't have any Domain name server setup.
I installed apache server and enter 127.0.0.1 and I can see the test page.
I enter my computer name http://mycomp/test.htm I can see the page
What I want to accomplish is to enter http://127.0.0.1/test.htm and the browser should see the test page and display http://mycomp/test.htm

Can this be done without a dns server?
0
 

Author Comment

by:helpJavaGuru
ID: 11745764
I believe apache should automatically  convert the entered ip http://127.0.0.1/test.htm to http://whatEverDomainName/test.htm
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 51

Expert Comment

by:ahoffmann
ID: 11747550
mod_rewrite is your friend

RewriteCond %{HTTP_HOST} ^127.0.0.1$
Rewrite Rule ^(.*)$ http://whatEverDomainName/$1

# to be improved in many ways (just to get you the idea)
0
 

Author Comment

by:helpJavaGuru
ID: 11748758
I the the following lines of codes in .htaccess file

RewriteEngine ON
RewriteCond %{HTTP_HOST} ^127.0.0.1$
Rewrite Rule ^(.*)$ http://whatEverDomainName/$1

When entered http://127.0.0.1/test.htm the 127.0.0.1 didn't change to the doman name I wanted. am I missing something?
0
 

Author Comment

by:helpJavaGuru
ID: 11748774
The .htaccess file is resided in the same folder where all web pages resided.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 11748895
better write it httpd.conf, or make shure that .htaccess is evaluated
or try:
Rewrite Rule ^(.*)$ http://whatEverDomainName/$1 [RL]
0
 

Author Comment

by:helpJavaGuru
ID: 11748914
So all I needed to do is to open httpd.conf and put the following lines at the bottom of the httpd.conf?

RewriteEngine on
Rewrite Rule ^(.*)$ http://whatEverDomainName/$1 [RL]

It doesn't work when I try this. I am new to the apache server.
0
 

Author Comment

by:helpJavaGuru
ID: 11749018
I think the problem is the R,L
I tried with the following changes:

<VirtualHost *:80>
RewriteEngine On
RewriteRule ^/(.*) http://mydummydomain/$1 [R,L]
</VirtualHost>

when I entered http://127.0.0.1/test.htm it will forwarded to http://mydummydomain/test.htm

This is not exactly what I want, I am doing testing on my computer, I entered http://127.0.0.1/test.htm

I would like it to display http://mydummydomain/test.htm  The mydummydomain is not valid domain name. It's just a dummy name.

Is it because I put the codes in <VirtualHost *:80>? Instead I should put it somewhere else?

Thanks.
0
 
LVL 51

Assisted Solution

by:ahoffmann
ahoffmann earned 60 total points
ID: 11750122
you need these lines (either VirtualHost directive or not, depends on your settings):

RewriteEngine ON
RewriteCond %{HTTP_HOST} ^127.0.0.1$
Rewrite Rule ^(.*)$ http://whatEverDomainName/$1 [R,L]

> The mydummydomain is not valid domain name. It's just a dummy
then it would not work, 'cause the browser tries to resolve that name (R == redirect)

The only way to do what you want is some kind of malware, for example javascript in your page which manipulates the address bar of your browser.
0

Featured Post

Building an interactive eFuture classroom

Watch and learn how ATEN provided a total control system solution including seamless switching matrix switch, HDBaseT extenders, PDU, lighting control to build an interactive eFuture classroom.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question