redirect from domain.com to www.domain.com not working

my domanins not redirect from domain.com to www.domain.com. This is a big trouble because search engines consider 2 webs with same content. Any help?

We need to know more about your system to give any meaningful advice about this, since this can have any number of reasons… Which web server? Apache? Configured through Virtualmin, Webmin or manually? Both names added as “ServerAlias”? Nameserver set up correctly? Etc. etc. etc.

I`m sorry. I talk about apache server cofigured trugh Virtualmin. Virtualmin was installed via script. And anything work well, but redirect not.
Directives:

SuexecUserGroup “#1003” “#1004” /etc/apache2/sites-available/domain.com.conf (2)
ServerName domain.com /etc/apache2/sites-available/domain.com.conf (3)
ServerAlias www.domain.com /etc/apache2/sites-available/domain.com.conf (4)
ServerAlias webmail.domain.com /etc/apache2/sites-available/domain.com.conf (5)
ServerAlias admin.domain.com /etc/apache2/sites-available/domain.com.conf (6)
DocumentRoot /home/domain/public_html /etc/apache2/sites-available/domain.com.conf (7)

Apache version 2.2.14

The subdomains (something.domain.com) work also well.

Thank you.

This looks like the Apache config is okay. Might be a name resolution problem. Are you operating the respective zone in your BIND? It’d be best if you posted the actual domain name in question, otherwise we can’t do tests here. :slight_smile:

If I do the redirect from .htacces it`s ok? or is just a “damage” solution?
My bind is configure corectly. Any check is whithout error, but redirect to www fail. Maybe a solution is to reinstall webmin + virtualmin with default settings?

Thank you a lot for answers.

Redirect via htaccess would probably work, yep, Although if I were you, I’d try to find out why it’s currently not working, since with newly created vservers, it usually works out of the box. So something is wrong, probably just a minor thing, and could affect other stuff too, so it’s hard to say if “patching it up” would be sufficient.

Reinstalling Virtualmin would be quite “steamroller tactics” for such a simple problem. If you reinstall VM every time you run into a little glitch, you’ll be spending a lot of time doing that. :wink:

Also note that the fact that “example.com” and “www.example.com” show by default the same page is not done via “redirects” as such, but by a) having both hostnames point to the same IP in the BIND zone, and b) having both hostnames as “ServerName”/“ServerAlias” directives in Apache. So it doesn’t first go to the one, to be redirected to the other, but DNS and webserver consider the two names to point to the same thing in the first place.

As I said, it would help if you posted the actual domain names, otherwise I can’t do any tests from my end.

Otherwise I can also offer to log on to your system and take a look at what might be wrong myself. (Don’t post any login info here of course, since this forum is public! I’ll give you personal contact data when required.) If you need reference for trustworthiness, Eric aka. Andreychek here (Virtualmin staff) will surely confirm that I’m “one of the good guys”. :wink:

Yes, I would like to give u access in my server. If u will trick me with something, it will be a good lesson for dumbs like me witch every time needs help from smart guys. Anyway, I appreciate your time spending with me. Thank you.

:slight_smile: You’re welcome. We all had to learn the stuff at some point. And Apache can indeed be a b*tch when it comes to serving the correct domain.

Are you using an instant messenger? If so, tell me which protocol. I have available: ICQ, AIM, YIM, Jabber, Skype, Windows Live. Otherwise email: fz {at} tianet.de