0

The file /srv/http/components/com_mycomponent/ajax/editAction.php was initialized with https://github.com/joomla/joomla-cms/issues/34586#issuecomment-865080001, except that we use

define('JPATH_BASE', __DIR__ . '/../../../');

The server root is at /srv/http. However, Uri::root() would return http://localhost/components/com_mycomponent/ajax/.

How do I make it return http://localhost/?

1
  • Creating random entry points is generally a bad practice. Why don't you use a proper controller?
    – Sharky
    Apr 6 at 7:24

1 Answer 1

1

In core applications the root URI is manually set by passing the root path as second parameter to Uri::root() method.

use Joomla\CMS\Uri\Uri;

Uri::root(false, rtrim(\dirname(Uri::base(true), 3), '/\\'));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.