Question

after porting my fully working SS3.1 Page from my Webserver http://mydomain.de to my locally installed XAMPP http://intranet/silverstripe I've got the problem that the Base Directory is now wrong in SS. It's the old one from the webserver / but it need to be /silverstripe

I already changed it in the .htaccess so that mod_rewrite works but $BaseDir returns / and if I try to use the SS Sitesearch than I get redirected to home/SearchForm?Search= instead of silverstripe/home/SearchForm?Search= after submitting the form.

Can someone please help me to fix this problem.

Thank you in advance

EDIT: I just call $SiteSearch in my Template. But the function is modified in my Page.php to search also through a dataobject.

public function results($data, $form){
    $results = $form->getResults();

    $query = htmlspecialchars($data['Search'], ENT_QUOTES,'UTF-8');
    $objects = ListingObject::get()->where("MATCH (Title, Link, Company, Category) AGAINST ('$query' IN BOOLEAN MODE)");      
    $results->merge($objects);

    $data['Results'] = $results;                  
    $data['Title'] = _t('SearchForm.SearchResults', 'Search Results'); 
    $data['Query'] = $query;

    return $this->customise($data)->renderWith(array('Page_results','Page')); 
}

without this code it also doesn't work

SOLUTION: I'm sry. I found the Problem. I didn't call $SiteSearch, because when I created the Page, I had to edit the form, so I hardcoded it... because of that, the submitted url is wrong now. I'm so sorry!

Was it helpful?

Solution

You might have to set an alternate base url in the SS config. Add this to your config.yml:

Director:
  alternate_base_url: '/silverstripe'

OTHER TIPS

$BaseDir should be $BaseHref in your template.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top