Jump to content

Recommended Posts

Hi,

 

I have an address on my main server http://www.website.com/directory and would like to redirect it to a subdomain http://subdomain.website.com/directory

 

The subdomain is not pointing to the same server as the main domain.

 

How would I set up a redirect in htaccess?

 

Thanks!

 

Link to comment
https://forums.phpfreaks.com/topic/292158-redirect-main-domain-to-subdomain/
Share on other sites

Hi,

 

I think I may have got confused. :)

 

I have a sitebuilder script that creates micro sites on the same domain - eg: www.website.com/micro1.

 

The script basically clones the homepage and allows me to change some colors etc. When the micro site is set up, it creates a redirect www.website.com/micro1 which goes back to www.website.com, but with the adjusted colors. What I want to do is to redirect www.website.com/micro1 to another url, for example http://sitebuilder.website.com/microsite1

 

I have discovered that there is no actual /micro1 folder in my root which is why the following redirect does not work:

 

Redirect 301 /micro1/ http://sitebuilder.website.com/microsite1

 

However, if I create a /micro1 folder in my root, the redirect works. I have a lot of sites, so I don't want to create folders for each microsite.

 

Is there another redirect I can do so I don't have to create a folder each time?

 

Thanks!

  • 1 month later...

That redirect does not work because it's not an IIS redirect.

You have two choices:

 

1. Buy Micronovae IIS Mod Rewrite for the server (dedicated or VPS only) which then allowed most htaccess to work on IIS.

2. Convert it to an IIS rewrite using the conversion tool in the IIS Manager (only available to the server admin). If not a server admin with "root" privileges, then you'll need to read some help docs online. Or ask here.

 

But first, yoiu need to create a mod_rewrite rule, not a pure htaccess rule. Those don't work at all.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.