+ Reply to Thread
Results 1 to 2 of 2

Thread: subdomain redirect

  1. #1
    Tenant is offline x10Hosting Member Tenant is an unknown quantity at this point
    Join Date
    Jan 2009
    Posts
    13

    subdomain redirect

    I am looking for a way to create a redirect that will do the following:

    redirect any subdomain to the same set of files without changing the url.

    We have the wildcard redirect in place but we are hosting multiple websites on our hosting package so the wildcard is sending the subdomain to the wrong website. We need to create a redirect that will direct them to the correct files.

    If possible we would like to use an htaccess redirect but if there is another matter we are open to suggestion.

    example

    test1.website.com
    test2.website.com
    test3.website.com

    will all use the files found in public_html/website.com/files

    The goal is for our sales team to put their name as the subdomain without us having to create new subdomains for everyone. The website will log the subdomain that is being used to give credit for the sales.

    ---------- Post added at 01:47 PM ---------- Previous post was at 09:51 AM ----------

    I have tried the following but it just shows

    RewriteEngine On
    RewriteRule ^\.htaccess$ - [F]
    RewriteCond %{HTTP_HOST} !^www\.parentsite\.com?$
    RewriteCond %{HTTP_HOST} ^([^.]+)\.correctsite\.com?$
    RewriteRule ^$ /correctsite [L]

    parentsite being the site that the account was created under
    /correctsite being the name of the folder that the addon domain was created in.

    But is just shows test.correctsite.com/directory

    im looking for a way to prevent this url change

  2. #2
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: subdomain redirect

    Do you mean someone going to "http://test.correctsite.com/" gets externally redirected to "http://test.correctsite.com/correctsite/"? What about "http://test.correctsite.com/foo"? From the rewrite rules, it looks like the request won't be rewritten at all. Do you have any other rewrite rules in that or any other .htaccess files?

    You seem to be using three different example directory names and two different domain names. Pick one and stick to it. Better yet, use the real ones so we can see what's really going on.
    Last edited by misson; 07-12-2010 at 07:20 PM.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

+ Reply to Thread

Similar Threads

  1. Subdomain Redirect
    By murphyslaw4267 in forum Free Hosting
    Replies: 0
    Last Post: 06-29-2010, 08:39 PM
  2. subdomain redirect
    By clanuis in forum Free Hosting
    Replies: 1
    Last Post: 08-24-2008, 09:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers