Link to home
Start Free TrialLog in
Avatar of helpJavaGuru
helpJavaGuru

asked on

IP to name base

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
ASKER CERTIFIED SOLUTION
Avatar of sunnycoder
sunnycoder
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of helpJavaGuru
helpJavaGuru

ASKER

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?
I believe apache should automatically  convert the entered ip http://127.0.0.1/test.htm to http://whatEverDomainName/test.htm
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)
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?
The .htaccess file is resided in the same folder where all web pages resided.
better write it httpd.conf, or make shure that .htaccess is evaluated
or try:
Rewrite Rule ^(.*)$ http://whatEverDomainName/$1 [RL]
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.
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.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial