bednee / cooluri

GIT repository for TYPO3 extension CoolUri
7 stars 12 forks source link

[BUGFIX] Process empty URI (site root) #14

Closed mbrodala closed 2 years ago

mbrodala commented 9 years ago

This makes sure the empty URI (/) is also processed to e.g. allow for enforcing a language path segment.

Fixes #13

mbrodala commented 9 years ago

Let's take the suggested change as a first proposal. It fixes the issue for me but in no way I can tell what negative side effects this has.

One remaining issue is that I have to at least manually add an URI entry for the root URI, e.g. en/ L=1&id=1

mbrodala commented 9 years ago

The change in the pull request is only one step. To actually get this working you need a few more steps:

  1. Add an URI entry for / with the desired URI parameters, e.g. L=1&id=1
  2. Open the root page, experience 404 behavior
  3. Edit the entry again and change it to the desired path, e.g. en/

From now on accessing / automatically redirects to /en/ and all other URIs continue to work. Now I wonder why initially adding the finally desired path does not work.

bednee commented 9 years ago

Hi,

you know, for some time, there's a feature to have default parameters. Frankly, I'm not sure what you are trying to achive here. If you wan't / to always redirect to /en, I'd suggest to write special mod_rewrite rule rather than bend CoolUri for it.

Jan

On 2014-12-19 09:50, mbrodala wrote:

The change in the pull request is only one step. To actually get this working you need a few more steps:

  • Add an URI entry for / with the desired URI parameters, e.g. L=1&id=1
  • Open the root page, experience 404 behavior
  • Edit the entry again and change it to the desired path, e.g. en/

From now on accessing / automatically redirects to /en/ and all other URIs continue to work. Now I wonder why initially adding the finally desired path does not work.

Reply to this email directly or view it on GitHub [1].

*

Links:

[1] https://github.com/bednee/cooluri/pull/14#issuecomment-67612361

mbrodala commented 9 years ago

I tried the new defaults but they didn't make any difference, the empty root URL is not processed at all, thus no defaults are applied.

I am trying to achieve full URL handling through CoolURI and thus easy editing by administrators in the TYPO3 CMS backend. This cannot be achieved if parts of the implementation are in a .htaccess.

bednee commented 9 years ago

So maybe it's just about wrong usage, can you send me piece of your configuration so I can have a look at it?

On 2014-12-19 10:01, mbrodala wrote:

I tried the new defaults but they didn't make any difference, the empty root URL is not processed at all, thus no defaults are applied.

I am trying to achieve full URL handling through CoolURI and thus easy editing by administrators in the TYPO3 CMS backend. This cannot be achieved if parts of the implementation are in a .htaccess.

Reply to this email directly or view it on GitHub [1].

*

Links:

[1] https://github.com/bednee/cooluri/pull/14#issuecomment-67613371

mbrodala commented 9 years ago

I cannot upload XML files so please bear with me:

<?xml version="1.0" encoding="utf-8"?>
<cooluri>

  <cache>
    <!-- ... --->
  </cache>

  <pagepath>
    <!-- ... --->
  </pagepath>

  <uriparts>
    <!-- ... --->
  </uriparts>

  <predefinedparts>
    <!-- ... --->
  </predefinedparts>

  <valuemaps>
    <valuemap>
      <parameter>L</parameter>
      <value key="de">0</value>
      <value key="fr">1</value>
      <value key="it">2</value>
    </valuemap>
  </valuemaps>

  <defaults>
    <value key="L">de</value>
  </defaults>

  <paramorder>
    <param>L</param>
  </paramorder>

  <cooluris>1</cooluris>

</cooluri>

In addition to this the following TypoScript is set:

config.linkVars = L
config.defaultGetVars.L = 0

This ensures all URLs on the site contain the L parameter.

mbrodala commented 9 years ago

Now I get why I currently need that additional step to get it working: CoolURI automatically creates an old link from / to en/ following the mentioned steps. Thus if you add it beforehand and apply this patch, the redirect happens as desired.

Still not sure about the side effects.

mbrodala commented 2 years ago

Not using this anymore.