Silverstripe 4 change base url - silverstripe

where is it possible to change the baseURL on Silverstripe v4? Also after rewrite the base tag with http is set at the website. I would like to specify the baseURL itself, which will be applied to all pages (front site, admin).
Thanks for every tip

It's good practice to set the base URL in the .env environment file so you can set separate base URLs for local development/ staging/ production etc.
We use the following line in the /.env file:
SS_BASE_URL="https://example.com/"
And then add the following to /app/_config/mysite.yml:
SilverStripe\Control\Director:
alternate_base_url: '`SS_BASE_URL`'

You can set an alternating base URL like so:
_config/config.yml
SilverStripe\Control\Director:
alternate_base_url: 'your/base/url/'

Related

css image path with version for CDN

I'm working with the following paradigm for handling my CDN caching:
Each path contains "?version", for example: http://mycdn.com/some-javascript-file.js?123
The same paradigm is used for all of my resources (js, css, images), the problem I'm encountering is images paths in a css file.
For example, I have the following snippet in one of my css's:
"url (../../Images/example.png)"
The problem is that this image path doesn't use the version paradigm, I would like to add the version to the path somehow, is there a nice way to do this, except of the following methods:
1) For each image change - also change the css with some dummy version.
"url (../../Images/example.png?1)" - change 1
"url (../../Images/example.png?55)" - change 2
2) Transfer all of my css's files to be aspx files and to use the code-behind in order to define the version:
"<%= html.VersionUrl("../../Images/example.png")%>"
3) Use dotless lib: http://www.dotlesscss.org/
Any other simple/nice idea?
The best solution which I've found was to change the version tag to be at the beginning of the url and to use url rewrite in order to process the requests.
So if for example I used to had:
http://website/Content/Images/1.png?123456
this will become to:
http://website/123456/Content/Images/1.png
Notice that I use url rewrite in order the process the request so that http://website/123456/Content/Images/1.png will actually bring the data from http://website/Content/Images/1.png

Am I able to create a taxonomy/term/%/x view path using the term alias?

I have enabled the built in taxonomy/term/% view
I have created a display with path /taxonomy/term/%/test
I also have a URL alias setup on the taxonomy/term path to be /fruits/apple
So I would expect this to work /fruits/apple/test would display my view.
When I browse to this path I get Page not found.
If I browse to the un-aliased path ie /taxonomy/term/156/test it works.
Should the alias work like this?
Ive tried every combination I can think of. Reenabled the view, created new displays, removed all other displays etc
Try this: Path redirect. If itsn't help, rewrite engine help to you.
Try sub-pathauto module.
This module extends that behavior by also matching known sub-paths and
replacing them with their respective alias.
For example, if user/1 is aliased to users/admin, this module rewrites
the link to the user contact page user/1/contact to use the aliased
URL users/admin/contact instead.

base URL problem

in my Drupal site
http://www.revdup.co.uk
I recently changed the domain name, I had to change a few absolute URLs and everything seems to be working fine now, except the front page, and only when I am logged in, not as a guest..
for some reason all the theme images (such as those used to build blocks appearance) are using an incorrect version of the base URL eg:
revdup.co.uk/revdup/themes/drupal_pwc010_tech/images/Block-s.png
instead of:
revdup.co.uk/themes/drupal_pwc010_tech/images/Block-s.png
I have changed the base URL variable in settings.php
Why is this only happening on one page and how can I fix it?
You'll need to explicitly clean the template cache. Go to Administrator->Themes->Selected theme->configure->Save.
This will regenerate the template cache with correct urls. Also clear the drupal cache in Admin/settings/performance.

Using 1 sitemap but dynamically change the target location of each link

I have a sitemap file in my project. None of the links on this file are contained on our server. They all are located on another project. We need this sitemap to mimic the navigation of the original site.
Right now the url is setup like this:
url-"~/folder a/file.aspx"
What I would like to do is dynamically change the server location of these links. Is there a way to do that?
Basically I don't want to have to hard code the dev.server or the prod.server in the sitemap.
Your best bet is probably to create a custom XmlSiteMapProvider with a "base URL" property that your URLs will be appended to. You can then change your base URL to the appropriate site (dev/prodction).

Drupal paths in themes

On certain pages drupal_get_path isn't working correctly (or it is and I've got the wrong function)
The base path is wrong
Example:
Image is supposed to be at
http://domain.com/sites/all/modules/pecapture/images/headline_dontmissout.jpg
But when on
http://domain.com/node/9
The URL is
http://domain.com/node/sites/all/modules/pecapture/images/headline_dontmissout.jpg
The same happens on the page
http://domain.com/admin/build/ and block edit page
How do I get the right path?
added base_path() to beginning of my paths...
base_path (http://api.drupal.org/api/base_path), if you use php code.
In html case, just add "/", like: /sites/all/modules/pecapture/images/headline_dontmissout.jpg
One problem: if you work on subfolder (Drupal installed in internal folder of main site): http://domain.com/subfoldersite, it will not correct, becase will remove "subfoldersite".

Resources