Solved

IP to name base

Posted on 2004-08-08
10
268 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 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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

840 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