Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

IP to name base

Posted on 2004-08-08
10
Medium Priority
?
285 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
  • 6
  • 3
10 Comments
 
LVL 45

Accepted Solution

by:
sunnycoder earned 195 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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 180 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

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…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses
Course of the Month9 days, 8 hours left to enroll

877 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