Jump to:

4952 Posts in 14282 Topics by 1491 members

Installing SilverStripe

SilverStripe Forums » Installing SilverStripe » htaccess

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

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

Page: 1 2
Go to End
Author Topic: 2973 Views
  • chrisio
    Avatar
    Community Member
    9 Posts

    htaccess Link to this post

    Hi,
    I have a problem with the htaccess file conflicting with other folder within my site. My hosting allows multiple domains to be registered and pointed to subfolders within the main htdocs.

    For example

    Maindomain.com >> htdocs
    secondarydomain.com >> htdocs/folder

    and so on. What is happening is that after installtion the htaccess file is screwing with all the secondary domains and causing server 500 errors. is there a way that I can alter the htaccess file to exclude certain folders...

    Heres hoping

    Thanks
    Chris

  • chrisio
    Avatar
    Community Member
    9 Posts

    Re: htaccess Link to this post

    Oop's never mind I have found the answer by searching correctly this time.
    Just uploaded a htaccess file to each sub folder I dont want re-written and its all cool.

    Thanks very much
    Chris

  • Juanitou
    Avatar
    Community Member
    323 Posts

    Re: htaccess Link to this post

    Hi Chris!

    I’m moving my sites to a server similar to the one you describe and I’m concerned about this subdomain thing. Could you please post the content of those .htaccess files? I’ve read that in some cases they have just to be there, even blank.

    Regards,
    Juan

  • yurigoul
    Avatar
    Community Member
    202 Posts

    Re: htaccess Link to this post

    Add this to your .htacces rules:

    RewriteCond %{REQUEST_URI} !^/dirname/.*

    Where dirname is the name of the folder you want to be able to access without silverstripe interfering with that.

    But I think you do not need that, because the .htacces will only interfere if you are accessing yourmaindomain.com/dirname, not if you acces yoursecondarydomain.com, even though it is in a subfolder of yourmaindomain.

  • Juanitou
    Avatar
    Community Member
    323 Posts

    Re: htaccess Link to this post

    Thank you, it’s very kind of you. I’ll test it when I change the hosting.

    Best regards,
    Juan

  • banal
    Avatar
    Community Member
    901 Posts

    Re: htaccess Link to this post

    This has been asked several times already.
    The simplest solution (in my opinion) is to put an .htaccess into the subdomain folder (since that .htaccess file will take precedence over the one in the root folder). There you would typically turn rewriting off, or define your own rewrite rules for the subdomain. To disable rewriting, put the following in your .htaccess (for the subdomain)

    <IfModule mod_rewrite.c>
    RewriteEngine Off
    </IfModule>

  • TylerK
    Avatar
    Community Member
    1 Post

    Re: htaccess Link to this post

    @banal

    Thanks for that tip, just the solution I was looking for!

  • EzraNaj
    Avatar
    Community Member
    11 Posts

    Re: htaccess Link to this post

    Hi
    I am having a problem with rewriting urls.

    I want
    http://www.domainname.com/forums/member.php?u=788
    to be redirected to
    http://www.domainname.com/

    The prob is that "?u=788" remains in the url ie it looks like this
    http://www.domainname.com/?u=788

    I want to have "?u=788" removed.

    I tried
    RewriteCond %{QUERY_STRING} .
    RewriteRule ^(.*)$ /$1? [R=301,L]

    but it redirects to http://www.domainname.com/sapphire/main.php

    I tried
    RewriteCond %{QUERY_STRING} .
    RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI}/$1? [R=301,L]

    but it still redirects to http://www.domainname.com/sapphire/main.php

    I tried

    RewriteCond %{QUERY_STRING} .
    RewriteRule ^(.*)$ http://www.domainname.com/$1? [R=301,L]

    It worked but I don't want to explicitly indicate the domain name since I'll be testing it on a dev test server and then to a staging server which means the domain names would vary.

    Any ideas how to solve this?

    Thanks in advance!

    2973 Views
Page: 1 2
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.