Jump to:

23355 Posts in 17838 Topics by 2862 members

General Questions

SilverStripe Forums » General Questions » .htaccess mess up

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 748 Views
  • abood
    Avatar
    Community Member
    4 Posts

    .htaccess mess up Link to this post

    im having a problem with my site as i tried to go live. i have at least 15 sites hosted on the same server, and im trying to make a silverstripe site in the main directory, what i did was put it in a subfolder and use the mod rewrite to get everything in order. Everything is working now except the canonicalization i guess. When i go to the site using http://sitename.com it works and when i use http://www.sitename.com gives me. The website server has not been able to respond to your request. Here is what i have in the .htaccess
    <IfModule mod_rewrite.c>
    RewriteEngine on

    RewriteCond %{HTTP_HOST} ^(www.)?sitename.com$

    RewriteCond %{REQUEST_URI} !^/mainsitefolder/
    #RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(.php)$

    RewriteCond %{REQUEST_URI} ^(.*)$
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{HTTP_HOST} ^(www.)?sitename.com$
    RewriteRule .* mainsitefolder/sapphire/main.php?url=%1&%{QUERY_STRING}

    </IfModule>
    ### SILVERSTRIPE END ###

    any help would be much appreciated

  • abood
    Avatar
    Community Member
    4 Posts

    Re: .htaccess mess up Link to this post

    nevermind, its been solved.

  • JoshuaLewis
    Avatar
    Community Member
    76 Posts

    Re: .htaccess mess up Link to this post

    I'm looking into doing the same thing. What was the source of the problem and its solution?

  • abood
    Avatar
    Community Member
    4 Posts

    Re: .htaccess mess up Link to this post

    <IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{REQUEST_URI} !(\.gif$)|(\.jpg$)|(\.png$)|(\.css$)|(\.js$)

    //added these two lines
    RewriteCond %{HTTP_HOST} ^mysite.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.mysite.com$

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

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