views:

227

answers:

2

I purchased a domain: josecvega.com

Whenever someone tries to access http://www.josecvega.com it forwards them to my web-server.

I have turned ON the mask, so when you initially reach my web-server of IP, 68.42.56.13, it still shows http://www.josecvega.com, but when you click on a link that takes you to another location on my web server, the http://www.josecvega.com disappears and turns into the IP address. I am currently trying to see if mod_rewrite can help solve this problem.

This is what I have so far in httpd.conf

RewriteEngine on
RewriteCond %{HTTP_HOST} =68.42.56.13

I am not sure how the rule would go to rewrite the URL.

Edit: My httpd.conf
I also understand that this issue is not strictly related to mod_rewrite, but I have tried fixing it in many different ways and non have seem to work, I was hoping that it could be done with mod_rewrite.

+2  A: 

Not sure mod_rewrite is relevant. You should configure your VirtualHost settings so that the ServerName is used.

For example:

NameVirtualHost *:80

<VirtualHost *:80>
ServerName josecvega.com
ServerAlias www.josecvega.com
DocumentRoot /var/www/vhosts/josecvega.com/htdocs
<Directory /var/www/vhosts/josecvega.com/htdocs>
 Options Indexes FollowSymLinks MultiViews
 AllowOverride None
 Order allow,deny
 allow from all
</Directory>
</VirtualHost>

This assumes of course that you have access to httpd.conf which it appears you do. You can add a ton more directives to VirtualHost if you want, but by default it will use whatever the master httpd.conf has for all settings.

Of course if you have only one website on your server anyway, you can just change the ServerName value in the main httpd.conf file.

I have tried what you suggested, but it is still showing my IP instead of the domain name. I have posted a link to my httpd.conf hoping you can tell me where I went wrong. Thanks again.
Jose Vega
Did this get resolved? I see the domain, so I assume so.In the future btw, use a pastebin to post files like this for security reasons.
+1  A: 

This is not related to the mod_rewrite.

See ServerName and UseCanonicalName directive. Set them to your hostname and enable canonical name.

J-16 SDiZ