Jump to:

4939 Posts in 16621 Topics by 1491 members

Installing SilverStripe

SilverStripe Forums » Installing SilverStripe » htaccess configuration for two separate sites

Getting SilverStripe up and running on your computer and on your web server.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 413 Views
  • juneallison
    Avatar
    Community Member
    108 Posts

    htaccess configuration for two separate sites Link to this post

    Hi,

    This is probably more of a general web dev question but I'm not sure how helpful my hosting support is going to be so I thought I'd ask it here.

    Basically I have a shared server with an existing and a new site. On other shared hosting accounts the file structure is usually something like this:
    - public_html
    -- firstsite.com
    -- secondsite.com

    For the server in question the structure is more like this:
    - public_html
    -- all of the folders and files of the first site loose in this directory
    -- secondsite.com

    So if I try to access secondsite.com from a browser, I am sent here instead:
    http://firstsite.com/secondsite.com

    ...which is obviously incorrect. My hosting support told me that if I rename the htaccess file secondsite.com will resolve as:
    http://secondsite.com

    I obviously just can't disable my htaccess file because that will bork the first site.

    So I'm looking at my htaccess file and thinking this might be the problematic line:

    ### Only allow access without the www. ####
       RewriteCond %{HTTP_HOST} !^firstsite\.come$ [NC]
       RewriteRule ^(.*)$ http://firstsite.com/$1 [R=301,L]

    or maybe it has something to do with this section?

    ### SILVERSTRIPE CONT ###
       RewriteBase /   
       RewriteCond %{REQUEST_URI} ^(.*)$
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]

    Any advice on what I need to add, change, or take away, would be great.

    Thank you!

  • juneallison
    Avatar
    Community Member
    108 Posts

    Re: htaccess configuration for two separate sites Link to this post

    To answer my own question I partially solved my problem by adding:

    RewriteRule ^secondsite\.com - [L,NC]

    before these lines:
    ### Only allow access without the www. ####
    RewriteCond %{HTTP_HOST} !^firstsite\.come$ [NC]
    RewriteRule ^(.*)$ http://firstsite.com/$1 [R=301,L]

    Now if I go to www.secondsite.com everything looks fine. But if I try to access secondsite.com (no www) the url still resolves as:
    http://firstsite.com/secondsite.com

    Any suggestions would be great.

    Thanks!

    413 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.