Jump to content

Recommended Posts

Posted

I originally created a domain (main.biz) and then created domain1.main.biz and domain2.main.biz on the server. All three (main.biz, domain1.com, and domain2.com) are registered domain names. It was then set up so that when someone typed in domain1.com, they would be sent to domain1.main.biz and that is what would show in the url address bar. Everything was working fine.

 

Then the client decided he wanted everything separate.

 

So I disengaged domain1 and domain2 from main.biz. They now are separate accounts and are reached at domain1.com and show domain1.com in the url address bar.

 

That's working fine also.

 

domain1 and domain2 are still physically located in the main.biz directory as separate folders. So the paths are:

 

public_html/domain1/

public_html/domain1/

within the main main directory.

 

Now my problem is that the original addresses of domain1.main.biz and domain2.main.biz have been spidered and are listed in the search engines. When these old links are clicked, they still work and go to domain1.main.biz and domain2.main.biz, that is what shows in the url address bar.

 

I need to write an Apache ModRewrite in the .htaccess file of main.biz which will redirect any requests for domain1.main.biz to domain1.com and domain2.main.biz to domain2.com.

 

I have read the rewrite rules and have tried to write them, but I don't understand what I'm doing and it doesn't work.

 

Can someone please help me write the rules correctly?

 

Thanks so much,

Miriam

Posted

I submitted a help ticket, and someone in support was kind enough to create this .htaccess file for me. The one for domain1 was placed in the domain1 folder, and the one for domain2 was placed in the domain2 folder.

/domain1

>RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain1.main.biz$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain1.main.biz$
RewriteRule ^(.*)$ http://www.domain1.com [R=301,L]

 

/domain2

>RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain2.main.biz$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain2.main.biz$
RewriteRule ^(.*)$ http://www.domain2.com [R=301,L]

 

I've been trying to study this code to try to understand what the different parts mean, but I'm not there yet.

 

Part of my problem occurred when I got very confused about what to do with the subdomains I had originally added in the main.biz control panel. And the re-directs I set up. Originally, everything worked. But when the client asked me to separate everything, I deleted the redirects, and I deleted the subdomains. That caused problems, and I finally figured out I had to put them back so I could redirect them and then the rewrite worked.

 

I'm still confused, but it's working.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...