PeterZog
asked on
Configuring proper index
I have a critical issue that is simple in nature. I am not familar with apache and I have www.abc.com going to the correct page and abc.com going to the incorrect page. I want to get abc.com to point to the same page that www.abc.com is pointed to.
I am currently searching through apache's documentation and forums... I gotta get this fixed tonight and any direction to the correct documentation page would be helpful.
Also, how can I tell what version of apache we are using?
P
I am currently searching through apache's documentation and forums... I gotta get this fixed tonight and any direction to the correct documentation page would be helpful.
Also, how can I tell what version of apache we are using?
P
What platform are you running Apache on?
In the <virtualhost www.abc.com> paramters add:
ServerAlias abc.com
So you have:
<virtualhost www.abc.com>
"other paramters"
ServerAlias abc.com
</virtualhost>
In the <virtualhost www.abc.com> paramters add:
ServerAlias abc.com
So you have:
<virtualhost www.abc.com>
"other paramters"
ServerAlias abc.com
</virtualhost>
ASKER
Thanks I'll give that a try. Apache is running on Windows Server. Does that have an impact?
Not with the ServerAlias.
However, it does to figure out what version of Apache you are running. In Windows go to program files and look for a directory like "Apache" or "Apache Software Foundation", under this there should be a directory with the version/release of Apache.
However, it does to figure out what version of Apache you are running. In Windows go to program files and look for a directory like "Apache" or "Apache Software Foundation", under this there should be a directory with the version/release of Apache.
ASKER
Ok, that took care of 50% of the problem. I didn't tell you that I have two domains that are hosting ... and they are both having the problem. What you suggested corrected the problem for one domain but not the other.
There is a difference in config for these two:
The NOW working one:
<Virtual Host www.abc.com>
ServerAdmin xxxxxxxxxx
DocumentRoot xxxxxxxxxxx
DirectoryIndex xxxxxxxxxxx
ServerName 216.17.xxx.xxx
ErrorLog xxxxxx
CustomLog xxxxxxxx
ServerAlias abc.com
</VirtualHost>
The one that is still incorrect:
<VirtualHost www.xyz.com>
ServerAdmin xxxxxxxxxx
DocumentRoot xxxxxxxxxxx
DirectoryIndex xxxxxxxxxxx
ServerName 216.17.xxx.xxx
ErrorLog xxxxxx
CustomLog xxxxxxxx
Alias /admin "/var/www/html/xyz/admin"
<Location /admin>
AuthName "Authorised Users"
DirectoryIndex admin.php index.html index.htm
AuthType basic
AuthUserFile /etc/.xyz
require valid-user
</Location>
ServerAlias xyz.com
</VirtualHost>
Is that exact code making the difference?
ServerAlias abc.com
There is a difference in config for these two:
The NOW working one:
<Virtual Host www.abc.com>
ServerAdmin xxxxxxxxxx
DocumentRoot xxxxxxxxxxx
DirectoryIndex xxxxxxxxxxx
ServerName 216.17.xxx.xxx
ErrorLog xxxxxx
CustomLog xxxxxxxx
ServerAlias abc.com
</VirtualHost>
The one that is still incorrect:
<VirtualHost www.xyz.com>
ServerAdmin xxxxxxxxxx
DocumentRoot xxxxxxxxxxx
DirectoryIndex xxxxxxxxxxx
ServerName 216.17.xxx.xxx
ErrorLog xxxxxx
CustomLog xxxxxxxx
Alias /admin "/var/www/html/xyz/admin"
<Location /admin>
AuthName "Authorised Users"
DirectoryIndex admin.php index.html index.htm
AuthType basic
AuthUserFile /etc/.xyz
require valid-user
</Location>
ServerAlias xyz.com
</VirtualHost>
Is that exact code making the difference?
ServerAlias abc.com
I would try what I have below. I would also check the logs to see if there are any errors.
<VirtualHost www.xyz.com>
ServerAdmin xxxxxxxxxx
DocumentRoot xxxxxxxxxxx
DirectoryIndex xxxxxxxxxxx
ServerName 216.17.xxx.xxx
ErrorLog xxxxxx
CustomLog xxxxxxxx
ServerAlias xyz.com
Alias /admin "/var/www/html/xyz/admin"
<Location /admin>
AuthName "Authorised Users"
DirectoryIndex admin.php index.html index.htm
AuthType basic
AuthUserFile /etc/.xyz
require valid-user
</Location>
</VirtualHost>
<VirtualHost www.xyz.com>
ServerAdmin xxxxxxxxxx
DocumentRoot xxxxxxxxxxx
DirectoryIndex xxxxxxxxxxx
ServerName 216.17.xxx.xxx
ErrorLog xxxxxx
CustomLog xxxxxxxx
ServerAlias xyz.com
Alias /admin "/var/www/html/xyz/admin"
<Location /admin>
AuthName "Authorised Users"
DirectoryIndex admin.php index.html index.htm
AuthType basic
AuthUserFile /etc/.xyz
require valid-user
</Location>
</VirtualHost>
ASKER
Hey I really appreciate the help... a couple things...
1. I just commented the extra code out for the time being. I'll see if someone screams about it.
2. The problem came back... I wanted to make sure that I actually made the change. So I commented out the ServerAlias code www.abc.com, saved the file, checked it and it went to the incorrect page, then I uncommented the code, saved it and it went to the incorrect page again. (???)
Could this be because of DNS caching or something? Does it take time sometimes for the httpd.conf changes to take effect? I have triple checked my code to make sure I am not missing something.
Peter
1. I just commented the extra code out for the time being. I'll see if someone screams about it.
2. The problem came back... I wanted to make sure that I actually made the change. So I commented out the ServerAlias code www.abc.com, saved the file, checked it and it went to the incorrect page, then I uncommented the code, saved it and it went to the incorrect page again. (???)
Could this be because of DNS caching or something? Does it take time sometimes for the httpd.conf changes to take effect? I have triple checked my code to make sure I am not missing something.
Peter
ASKER
This server has multiple instances of apache folders (different versions and projects). How can I tell which httpd.conf is actually being used?
Try the Following
NameVirtualHost *:80
<VirtualHost *:80>
ServerName abc.com
ServerAlias abc.com *.abc.com 216.17.xxx.xxx
DocumentRoot xxxxxxxxxxxxxxxxxxxxxx
ServerAdmin xxxxxxxxxx
DirectoryIndex xxxxxxxxxxx
ErrorLog xxxxxx
CustomLog xxxxxxxx
</VirtualHost>
<VirtualHost *:80>
ServerName xyz.com
ServerAlias xyz.com *.xyz.com 216.17.xxx.xxx
DocumentRoot xxxxxxxxxxxxxxxxxxxxxx
ServerAdmin xxxxxxxxxx
DirectoryIndex xxxxxxxxxxx
ErrorLog xxxxxx
CustomLog xxxxxxxx
</VirtualHost>
NameVirtualHost *:80
<VirtualHost *:80>
ServerName abc.com
ServerAlias abc.com *.abc.com 216.17.xxx.xxx
DocumentRoot xxxxxxxxxxxxxxxxxxxxxx
ServerAdmin xxxxxxxxxx
DirectoryIndex xxxxxxxxxxx
ErrorLog xxxxxx
CustomLog xxxxxxxx
</VirtualHost>
<VirtualHost *:80>
ServerName xyz.com
ServerAlias xyz.com *.xyz.com 216.17.xxx.xxx
DocumentRoot xxxxxxxxxxxxxxxxxxxxxx
ServerAdmin xxxxxxxxxx
DirectoryIndex xxxxxxxxxxx
ErrorLog xxxxxx
CustomLog xxxxxxxx
</VirtualHost>
ASKER
It still doesn't work. How can I make sure that the httpd.conf that I am editting is the one being used?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad to see you got it working. Thanks.
ASKER
Peter