This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Im using rich text editor in the back end to edit my description content . I want to paste some link in the editor like <a href="https://mysite/project/services">Go to Services</a>. Its good when I paste the entire url. But I dont want to specify my entire url, i just want to initiate my page like <a href="services">Go to Services</a> . If I do so the link in the front end view appears as full url including the slug that I want to redirect, say https://mysite/project/current_page/services. I know how to set the base url for the link inside the content using php section and twig markup in the front end page.
But Is there a way to get my base url within the rich text editor itself ?
Try using relative path:
<a href="/services">Go to Services</a>
or
<a href="/project/services">Go to Services</a>
If you preceed url with /
than it will lead to {base_url}/{your_path_in_href}.
Last updated
Has anyone managed to get this to work?
My site is in a sub-directory: http://root/subDir
.
So, a link that is added in RichText Editor like
<a href="/services">Go to Services</a>
ends up pointing to http://root/services
instead of http://root/subDir/services
.
Setting RewriteBase
in .htaccess causes a 500 error.
Adding
<base href="...">
in the html
<head>
section does nothing.
Where in OctoberCMS should the base_url be set so that relative links will work?
I think this will never works unless there is special notation for link creation (like [services]).
There is a space for a new plugin, that would be able to transform {{ 'services'|page }} inside rich text editor to regular URL - just like we do it with Twig.
If you just try to match development and production environment, you have probably only two options:
Virtual host
- you have
www.domain.com
as production - you set up local environment (by hand or with MAMP/WAMP) to add virtual host
www.domain.com
- you add record to your
hosts
file (like: 127.0.0.1 www.domain.com)
With this you can point your browser to www.domain.com
and still be on your own machine.
URL replace
- dirty but fast solution -- you can export DB (or use pages text files) and in text editor find
http://mysite/project
string and replace withhttp://www.domain.com
and import/move to your production - you must be EXTRA CAREFUL to be in sync with production data !
- I don't like this solution and use it ONLY when necessary
You're welcome :)
I forgot to note that if you want to see production site, you have to comment added line in hosts
file like this:
# 127.0.0.1 www.domain.com
Or you can use some GUI to do this for you (eg. MAMP PRO at Mac OS X).
1-6 of 6