FURL not working and error log shows issue with modx.php

I moved a site to a new host. the site uses FURLs. however FURL is not working and the links generated by modx lead to error page. If I disable FURL I an see the resource in full.
my modx error log is full of these entries:

[2023-08-14 08:00:07] (ERROR @ /var/www/mysite/core/src/Revolution/modX.php : 1072) `` is not a valid integer and may not be passed to makeUrl()

this is on revo 3.0.3-pl
my header has

<base href="[[!++site_url]]" />

any ideas how to resolve?

server is Server version: Apache/2.4.38 (Debian) and using php 7.4

forgot to mention Manager is working fine. its just the front end.

If you have (for example) an URL like this: https://www.yourdomain.com/test.html.

Does it work if you call it like this instead? https://www.yourdomain.com/index.php?q=test.html
With the alias added as the request parameter “q” (Presuming that the value of the system setting “request_param_alias” is q).

If that works, then the problem is the .htaccess file.

Thanks. same issue. page renders but its the error page and the CSS is all broken due to FURL not loading the CSS file.

this is my htaccess lines that aren’t disabled:

RewriteEngine On
RewriteBase /

RewriteRule "^\.well-known/" - [L]
RewriteRule "/\.|^\.(?!well-known/)" - [F]
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

If this is a normal CSS file, a file that exists on the file system, then MODX is not involved when requesting this file. Apache should return the file no matter what the settings in MODX are.

Can you successfully request any file in the “assets” folder?
Are all the paths correct in the file core/config/config.inc.php?

the CSS is a modx resource set as CSS not a system file (database only) and it worked flawlessly on previous host. apache indeed serves fine other system files CSS I have.
I can confirm I am able to request files under assets/
I also confirmed all the paths are correct under these files:


what puzzle me is that I have other few domains on same host as VirtualHosts running modx with working FURL. so its something specific to this installation / VirtualHost.

Are the values in the database table modx_site_content → column uri correct?
In the cache file /core/cache/context_settings/web/context.cache.php, do the resources under the key 'aliasMap' have the correct values?

Basically FURLs in MODX work like this:

  • A request like https://www.yourdomain.com/test.html gets rewritten in the .htaccess file to https://www.yourdomain.com/index.php?q=test.html
  • In MODX, the request parameter “q” is used to search for a matching “alias” in the 'aliasMap' (or the column uri in the database table).
  • The error page is shown if no matching resource can be found.

yes they seems correct leading to the Alias or to the correct ID in the cached context.cache.php

Do you have multiple contexts?
Any chance a context router plugin isn’t working correctly, so that MODX searches the resource in the wrong context?

no I only have one web context.

I have no idea what’s going on here.

You could (temporarily) add a custom plugin to try to debug what’s happening.
Some code like this may help to clear up the situation.
It logs some information and the values of important settings to the MODX error log.

if($modx->context->get('key') != "mgr"){
    $requestParamAlias = $modx->getOption('request_param_alias', null, 'q');
    $requestAlias = $_REQUEST[$requestParamAlias] ?? '';
    $eventName = $modx->event->name;
    switch($eventName) {
        case 'OnMODXInit':
            $friendly_urls = $modx->getOption('friendly_urls', null, false) ? 'yes' : 'no';
            $modx->log(MODX_LOG_LEVEL_ERROR, "Event={$eventName} | Friendly-URLs={$friendly_urls} | Request-parameter={$requestParamAlias} | Request-alias={$requestAlias}");
        case 'OnHandleRequest':
            $resourceId = $modx->findResource($requestAlias) ?: 'not found';
            $modx->log(MODX_LOG_LEVEL_ERROR, "Event={$eventName} | Resource-ID={$resourceId} | Request-parameter={$requestParamAlias} | Request-alias={$requestAlias}" );
        case 'OnPageNotFound':
            $modx->log(MODX_LOG_LEVEL_ERROR, "Event={$eventName} | Request-parameter={$requestParamAlias} | Request-alias={$requestAlias}");
  • Does the request parameter “q” have the correct value?
  • Does the code find the corresponding resource with $modx->findResource()?
  • Does the event “OnPageNotFound” get invoked?

Thank you for all the help @halftrainedharry .
which system events to check for the plugin? just the OnPageNotFound?

No, all three of them → OnMODXInit, OnHandleRequest and OnPageNotFound.

thanks. so now we have bunch of such entries in the log

[2023-08-15 09:39:21] (ERROR @ /var/www/domain.com/core/cache/includes/elements/modx/revolution/modplugin/15.include.cache.php : 16) Event=OnHandleRequest | Resource-ID=not found | Request-parameter=modxq | Request-alias=

**Resource-ID=not found ** pop out

So if the system setting request_param_alias is different from the default q, then you have to change that in the .htaccess file as well:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?modxq=$1 [L,QSA]

Thank you so much!!!
that did it.
I wonder where did modxq came from.

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.