Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » change the path for silverstripe-links?

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 1281 Views
  • boenner
    Avatar
    Community Member
    2 Posts

    change the path for silverstripe-links? Link to this post

    is there an easy way to make silverstripe use another directory for internal links, than the directory it is installed in? For example: silverstripe is installed in "silverstripe_cms" - but instead of "/silverstripe_cms/home/" i want the links to use "/silverstripe/home/" ...

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: change the path for silverstripe-links? Link to this post

    You would need to write a custom .htaccess rewrite rule. Not for beginners but you might find these helpful

    http://www.yourhtmlsource.com/sitemanagement/urlrewriting.html
    http://www.askapache.com/htaccess/mod_rewrite-tips-and-tricks.html
    http://corz.org/serv/tricks/htaccess2.php

    For your case you would need to do something like this. I think

    RewriteRule ^(.*)/silverstripe/(.*)$ $1/silverstripe_cms/$2 [L,R=301]

  • boenner
    Avatar
    Community Member
    2 Posts

    Re: change the path for silverstripe-links? Link to this post

    that's my problem - there is no mod_rewrite on the webspace i am currently working on (it's a cheap one and the hoster won't enable ist). Therefore i'm trying to find a way to run silverstripe without apache-urlrewriting.
    is there someone who did this already or can you give me a little hint how to do it "the best way"? ;)

  • Sam
    Avatar
    Administrator
    679 Posts

    Re: change the path for silverstripe-links? Link to this post

    Well, all of the URLs internally map to sapphire/main.php?url=(friendly url)

    You could try making a small file such as p.php in your site root:

    You could then access URLs:

    http://www.mysite.com/p.php/Security/login

    The p.php script would need to be a modified version of main.php, that manually parses the contents of the $_SERVER variables and then passes control to Director::direct(). It would also need to do things like chdir('sapphire') to ensure that includes and relative file references work.

    You would probably want to use something like Director::setBaseUrl("http://www.mysite.com/p.php/") to ensure that all the URLs matched up properly.

    It's not going to a simple matter of flipping a switch, but it would be possible.

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