You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
New language relevant PR in upstream repo: joomla/joomla-cms#42704 Here are the upstream changes:
Click to expand the diff!
diff --git a/administrator/language/en-GB/plg_system_sef.ini b/administrator/language/en-GB/plg_system_sef.ini
index d4be5f41bca6..654019797899 100644
--- a/administrator/language/en-GB/plg_system_sef.ini+++ b/administrator/language/en-GB/plg_system_sef.ini@@ -5,6 +5,8 @@
PLG_SEF_DOMAIN_DESCRIPTION="If your site can be accessed through more than one domain enter the preferred (sometimes referred to as canonical) domain here. <br><strong>Note:</strong> https://example.com and https://www.example.com are different domains."
PLG_SEF_DOMAIN_LABEL="Site Domain"
+PLG_SEF_INDEXPHP_DESCRIPTION="This option enables a stricter handling of 'index.php' in URLs when 'Use URL Rewriting' is enabled in Global Configuration. It will remove 'index.php' if a URL still contains it and redirect incoming requests with 'index.php' to the version without the 'index.php'."+PLG_SEF_INDEXPHP_LABEL="Strict handling of index.php"
PLG_SEF_TRAILINGSLASH_DESCRIPTION="Force Joomla to only use URLs with or without trailing slash. When set, this will force the right URL with redirects and is only applied when 'Add suffix to URL' is disabled."
PLG_SEF_TRAILINGSLASH_LABEL="Trailing slash for URLs"
PLG_SEF_TRAILINGSLASH_OPTION_NONE="No change"
diff --git a/plugins/system/sef/sef.xml b/plugins/system/sef/sef.xml
index 39b87d9b4204..a0012238b554 100644
--- a/plugins/system/sef/sef.xml+++ b/plugins/system/sef/sef.xml@@ -31,6 +31,19 @@
validate="url"
/>
+ <field+ name="indexphp"+ type="radio"+ label="PLG_SEF_INDEXPHP_LABEL"+ description="PLG_SEF_INDEXPHP_DESCRIPTION"+ layout="joomla.form.field.radio.switcher"+ default="0"+ filter="boolean"+ >+ <option value="0">JNO</option>+ <option value="1">JYES</option>+ </field>+
<field
name="trailingslash"
type="list"
diff --git a/plugins/system/sef/src/Extension/Sef.php b/plugins/system/sef/src/Extension/Sef.php
index 429cf5500c55..d431f6b18e2e 100644
--- a/plugins/system/sef/src/Extension/Sef.php+++ b/plugins/system/sef/src/Extension/Sef.php@@ -68,23 +68,30 @@ public static function getSubscribedEvents(): array
public function onAfterInitialiseRouter(AfterInitialiseRouterEvent $event)
{
if (
- !is_a($event->getRouter(), SiteRouter::class)- || !$this->app->get('sef')- || $this->app->get('sef_suffix')- || !$this->params->get('trailingslash')+ is_a($event->getRouter(), SiteRouter::class)+ && $this->app->get('sef_rewrite')+ && $this->params->get('indexphp')
) {
- return;+ // Enforce removing index.php with a redirect+ $event->getRouter()->attachParseRule([$this, 'removeIndexphp'], SiteRouter::PROCESS_BEFORE);
}
- if ($this->params->get('trailingslash') == 1) {- // Remove trailingslash- $event->getRouter()->attachBuildRule([$this, 'removeTrailingSlash'], SiteRouter::PROCESS_AFTER);- } elseif ($this->params->get('trailingslash') == 2) {- // Add trailingslash- $event->getRouter()->attachBuildRule([$this, 'addTrailingSlash'], SiteRouter::PROCESS_AFTER);- }+ if (+ is_a($event->getRouter(), SiteRouter::class)+ && $this->app->get('sef')+ && !$this->app->get('sef_suffix')+ && $this->params->get('trailingslash')+ ) {+ if ($this->params->get('trailingslash') == 1) {+ // Remove trailingslash+ $event->getRouter()->attachBuildRule([$this, 'removeTrailingSlash'], SiteRouter::PROCESS_AFTER);+ } elseif ($this->params->get('trailingslash') == 2) {+ // Add trailingslash+ $event->getRouter()->attachBuildRule([$this, 'addTrailingSlash'], SiteRouter::PROCESS_AFTER);+ }- $event->getRouter()->attachParseRule([$this, 'enforceTrailingSlash'], SiteRouter::PROCESS_BEFORE);+ $event->getRouter()->attachParseRule([$this, 'enforceTrailingSlash'], SiteRouter::PROCESS_BEFORE);+ }
}
/**
@@ -250,6 +257,38 @@ function ($match) use ($base, $protocols) {
$this->getApplication()->setBody($buffer);
}
+ /**+ * Enforce removal of index.php with a redirect+ *+ * @param Router &$router Router object.+ * @param Uri &$uri Uri object.+ *+ * @return void+ *+ * @since __DEPLOY_VERSION__+ */+ public function removeIndexphp(&$router, &$uri)+ {+ // We only want to redirect on GET requests+ if ($this->app->getInput()->getMethod() !== 'GET') {+ return;+ }++ $origUri = Uri::getInstance();++ if (substr($origUri->getPath(), -9) === 'index.php') {+ // Remove trailing index.php+ $origUri->setPath(substr($origUri->getPath(), 0, -9));+ $this->app->redirect($origUri->toString(), 301);+ }++ if (substr($origUri->getPath(), \strlen(Uri::base(true)), 11) === '/index.php/') {+ // Remove leading index.php+ $origUri->setPath(Uri::base(true) . substr($origUri->getPath(), \strlen(Uri::base(true)) + 10));+ $this->app->redirect($origUri->toString(), 301);+ }+ }+
/**
* Remove any trailing slash from URLs built in Joomla
*
The text was updated successfully, but these errors were encountered:
New language relevant PR in upstream repo: joomla/joomla-cms#42704 Here are the upstream changes:
Click to expand the diff!
The text was updated successfully, but these errors were encountered: