PDA

View Full Version : Second domain problems



millennium
07-08-2009, 02:28 PM
I've read through several related threads on the forum but I cannot figure out what I am doing wrong. I'm a novice at this stuff. Help?!?!

Here's background:
Prior to adding a seconddomain.com I had onedomain.com. I had loaded wordpress to /var/www/html/wordpress/. I added an .htaccess file to /var/www/html with the following: redirect 301 /index.html http://www.twowheeltales.com/wordpress/ so that when someone browses to onedomain.com, they are automatically redirected to onedomain.com/wordpress/ Anyway, onedomain.com working fine.

Here's current Issue:
Now, I have added a seconddomain.com to the account using the site manager and the DNS is actively pointing to westhost (for a few weeks). I've used the site manager to give a new directory for seconddomain.com /var/www/html/wordpress2. I uploaded wordpress a second time (completely separate install from the first install) to /var/www/html/wordpress2/ When I type seconddomain.com in a browser, I go to onedomain.com/wordpress/ but that's NOT what I want--I want to go to onedomain.com/wordpress2/ I tried deleting the .htaccess file, but that did not help (and messed up things when you type in onedomain.com).

Any ideas?

nventurella
07-08-2009, 04:58 PM
.htaccess files are recursive. This means your redirect applies to all folders within /var/www/html/. Since you put the folder for seconddomain.com inside of /var/www/html, this means the .htaccess file applies to both domains.

The solution is to put each domian in a seperate directory. Never put one domain's directory within another's. Don't make the folder for seconddomain.com a subdirectory of /var/www/html. Instead, make a new folder like /var/www/seconddomain.com and put the pages there instead.

Note: You'll also need to make sure that in the /etc/httpd/conf/httpd.conf file, within the <Directory /> section, that the line beginning with "AllowOverrides" reads "AllowOverrides All" if it does not. Contact WestHost technical support (links below) if you need assistance checking this setting or making this change.

lobstershell
08-10-2009, 02:37 PM
This worked for me, too! Rather than just do it for all (which per the comments is not secure), I copied the <Directory /var/www/html> settings and made a second entry that pointed to the new 2nd domain's directory.

Thanks Nick!

millennium
09-01-2009, 01:12 AM
OK, its been a while, but I finally got back to this project. I'm still having problems.

Here's what I've done since last time: I created var/www/seconddomain as suggested and put my files for seconddomain in there. Then, I changed httpd.conf to read as follows:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName firstdomain.com
ServerAlias www.firstdomain.com
DocumentRoot /var/www/html
</VirtualHost>
<VirtualHost *:80>
ServerName seconddomain.com
ServerAlias www.seconddomain.com
DocumentRoot /var/www/seconddomain
</VirtualHost>
Then, I restarted the account.

Also, here's what my .htaccess file contains in the var/www/html folder:
redirect 301 /index.php http://www.firstdomain.com/wordpress/

But, it didn't work. When I type seconddomain.com in a browser, it still goes to firstdomain.com/wordpress/

Any suggestions??

scain
09-01-2009, 03:51 AM
Dear Millennium,

The code,


redirect 301 /index.php http://www.firstdomain.com/wordpress/

Will take requests for http://seconddomain.com/index.php and write the URL http://www.firstdomain.com/wordpress/.

If what you are trying to do is have requests for http://seconddomain.com load the Wordpress blog located in /var/www/html/wordpress/, that can be easily accomplished.

All you would need to do is in the Site Manager set the secondary domain directory to /var/www/html/wordpress/. After making this change you would also need to edit the database in 2 places. Bring up phpMyAdmin by going to http://primarydomain.com/pma (it would first need to be installed through the Site Manager), and then click on the wordpress database in question. Then click the wp-options table and click the browse tab. Once here, click the edit icon next to row 1, siteurl to http://seconddomain.com and click Go to save it. Now go to page 2 and edit row 39, home to http://seconddomain.com and click Go.

Now remove the .htaccess that is redirecting and you should be able to simply visit http://seconddomain.com and it should load the Wordpress Blog. Keep in mind when doing this the blog will no longer be accessible using http://firstdomain.com/wordpress any longer as Wordpress is set itself to use the URL http://seconddomain.com/

Hope that is the information you were looking for, if you need further assistance do not hesitate to ask.

wildjokerdesign
09-01-2009, 06:49 AM
millennium,

From reading your first post along with your second, it sounds like you did the correct thing. What may be the problem is that you are seeing a cached version of the second domain.

If the .htaccess file with the code is indeed in var/www/html for the first domain then it would not affect your second domain that is located in /var/www/seconddomain. I think maybe Skyler missed that part. :)

Something else to remember, is that if you want .htaccess to work for your second domain now you need to edit your httpd.conf with the "AllowOverrides All" directive. Here is what you want the VirtualHost container for your second domain to look like.


<VirtualHost *:80>
ServerName seconddomain.com
ServerAlias www.seconddomain.com
DocumentRoot /var/www/seconddomain
<Directory /var/www/seconddoamin>
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

There are some other things you may want in that Directory container also depending on what you do with your second domain.
Example:

Options FollowSymLinks MultiViews Includes ExecCGI
AddHandler cgi-script .cgi .pl .py .sh
The above sets your second domain up pretty much like your primary one so that you can run cgi and Perl scripts along with a couple other things. If you are just running wordpress you shouldn't really need that.

millennium
09-01-2009, 11:51 AM
millennium,

From reading your first post along with your second, it sounds like you did the correct thing. What may be the problem is that you are seeing a cached version of the second domain.

If the .htaccess file with the code is indeed in var/www/html for the first domain then it would not affect your second domain that is located in /var/www/seconddomain. I think maybe Skyler missed that part. :)



I cleared my browswer cache--no dice. And, yes, the .htaccess file is indeed in var/www/html (it's not affecting the second domain--when I delete it, the second domain still isn't working). Also, BTW, I don't need a .htaccess file for the second domain, but thank you for the extra pointers.

Any other ideas? Is there something else in the httpd.conf file that could be causing the virtual host container for the second domain to be ignored?

wildjokerdesign
09-01-2009, 01:34 PM
Did you make the changes to the VirtualHost container manually in httpd.conf or did you use the Site Manager to delete and then create the second domain again pointing to the new location? If you have not already try restarting your account. If you made your edits manually you would need to do this for the changes to take effect.

scain
09-03-2009, 12:33 AM
Dear Millennium,

I'm sorry you were unable to get this issue resolved. My previous response was looking at the current way things were setup, there was only one WordPress database, so it appeared you were attempting to utilize the default WordPress installation for the secondary domain. I apologize that I misread what you were trying to accomplish. Wildjoker is correct, and here is a fantastic post on setting up a fresh install of WordPress.

http://forums.westhost.com/showthread.php?t=13309&highlight=wordpress

I hope that is able to resolve your issue with your secondary domain's installation of WordPress.

millennium
05-07-2010, 03:16 PM
BTW--I fixed the problem several months ago. I had to make a change within Wordpress admin for the second domain's wordpress install. I think it was a password or something--maybe it was in the wp-config.php file. Anyway, you guys were very helpful.