Jump to:

4873 Posts in 7242 Topics by 1471 members

Installing SilverStripe

SilverStripe Forums » Installing SilverStripe » Hide the subdirectory silverstripe is in

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: 2351 Views
  • coffeymachine
    Avatar
    Community Member
    10 Posts

    Hide the subdirectory silverstripe is in Link to this post

    What's up?

    I have installed SilverStripe into a subdirectory on my web server, and I want my domain name to go straight to SilverStripe so I can use other subdirectories for other domain names I am going to get in the future. I have successfully been able to point my main domain to the /silverstripe subdirectory, but the problem I have now is when I am browsing through my SilverStripe site it still has /silverstripe in the URL. I want to get rid of this.

    e.g.
    www.mydomain.com
    actually points to
    www.mydomain.com/silverstripe
    but appears in the browser URL bar as
    www.mydomain.com

    When I click to say, the About Us page, the URL becomes
    www.mydomain.com/silverstripe/about-us/

    Is there a way to modify the .htaccess file to simply hide "/silverstripe" from the browser's URL bar?
    Another approach might be to somehow modify SilverStripe's base URL, although I've read around the forums that people have run into problems with this approach.

    This seems like it should be a very simple thing to do, but I spent hours yesterday Googling this to no avail. Any help would be appreciated. Thanks!

  • yurigoul
    Avatar
    Community Member
    202 Posts

    Re: Hide the subdirectory silverstripe is in Link to this post

    Isn't this something you should discuss with your provider?

    And on another note, I do think you can just use your subdirs for other domains even if silverstripe resides in the top domain. The htacccess file in yor public_html folder (or whatever it is called) is ignored for subdomains and addon domains. I have my addon/sub domains in a folder starting with a an underscore so I am sure that no names I can come up with will intervene with those folders (in my case I am using _domains for all my domains).

    And since I also sometimes have to give people direct access to some files - and not all of them are comfortable with ftp - I also have the rule RewriteCond %{REQUEST_URI} !^/_.*/.* added to my htaccess

  • anthonyberry
    Avatar
    Community Member
    4 Posts

    Re: Hide the subdirectory silverstripe is in Link to this post

    I am having the same problem and can't find an answer anywhere! Any pointers anyone??

  • Pigeon
    Avatar
    Community Member
    243 Posts

    Re: Hide the subdirectory silverstripe is in Link to this post

    Right, I'm no .htaccess expert, but this is my take on it.

    If you were able to get the htaccess folder in the root of your public_html to check the http_host and then determine if it is the SS domain, it would apply slightly modified SS htaccess rules.

    This isn't working code, but shows my idea:

    ### SILVERSTRIPE START ###
    <Files *.ss>
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1
    </Files>

    <IfModule mod_rewrite.c>
    RewriteEngine On

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

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

    So the idea is check the domain and then re-write to subdir/sapphire... Hopefully someone with some proper htaccess knowledge will correct this so it's working

  • coffeymachine
    Avatar
    Community Member
    10 Posts

    Re: Hide the subdirectory silverstripe is in Link to this post

    I was never able to figure this out.

    I gave up and finally moved all the code to my base directory. Doing that was really easy and didn't cause anything to break. Just be sure you move the .htaccess file with it.

    This was never a critical issue, I just wanted to do this for cleanliness and ease of backups down the road. Now all my SilverStripe files and folders are alongside my other unrelated files. It's a little messy but it works.

  • felito
    Avatar
    Community Member
    10 Posts

    Re: Hide the subdirectory silverstripe is in Link to this post

    Any update about this?

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