Jump to content

Allow protocol file:// in FieldType URL and CKEditor links


Recommended Posts


I am currently building a intranet which will be hosted on the local network of a company. This intranet has many links to files on their fileserver with the protocol file://.

So for example the links look like this file://domain.tld/filename.ext

  • When I try to insert such a link into a URL field, I get the error, that only the protocol http:// is allowed.
  • When I try to insert such a link into a CKEeditor link, it gets stripped out.

Is it possible to insert such links into the FieldType URL and CKEditor.

I know that I could use a FieldType Text or insert a RewriteRule in the .htaccess file, but I am looking for a more elegant solution. ?

Regards, Andreas

Link to comment
Share on other sites

4 hours ago, AndZyk said:

Thank you @louisstephens for the hint. I tried it out, but the link still gets stripped out, even with disabled ACF. Do you have configured extra allowed content?

Maybe a RewriteRule in the .htaccess file would be the easiest solution. ?

Ah, I did not have extra allowed content enabled, but it was a bit confusing for me as I had to add it to the toolbar and the icon appeared to be exactly like the current "url" icon. 

Link to comment
Share on other sites

  • 1 month later...

My solution for textareas with CKEditor is now a simple Textformatter module. ?

class TextformatterReplaceLinks extends Textformatter implements Module {

    public static function getModuleInfo() {
        return array(
            "title" => "Replace Links",
            "version" => "1.0.0",
            "summary" => "Find and replace links of domain.",
            "author" => "AndZyk",
            "singular" => true,
            "requires" => "ProcessWire>=2.6",
            "icon" => "link"

     * Find and replace the input string
     * @param string $str The block of text to parse
     * The incoming string is replaced with the formatted version of itself.

    public function format(&$str) {

        $str = preg_replace("/(http|https):\/\/example.com/", "file://example.com", $str);


Regards, Andreas

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...