Forums / Cotonti / Support / Custom word instead of "tags" in rewrite mode

Eugene
#1 2012-03-05 20:10

How I can change word "tags" in links:

website.me/tags/some-tag -> website.me/collection/some-tag

What is right way from Cot point of view? Do I need to plug into the hook urleditor.rewrite.first or something like that?

Trustmaster
#2 2012-03-06 06:38

You could copy plugins/urleditor/presets/handy.dat to datas/urltrans.dat and modify that bit there, then switch from Handy preset to Custom.

plug	e=tags&a=pages&t=*		collection/{$t}{!$a}{!$e}
plug	e=tags&a=*&t=*			collection/{$a}/{$t}{!$e}
plug	e=*						collection{!$e}
May the Source be with you!

Dit bericht is bewerkt door Trustmaster (2012-03-08 17:15, 12 jaren ago)
Eugene
#3 2012-03-06 11:14

Awesome!

thanks a lot! )

it works well, but I missed .htaccess part also. As I understood I have to add a string there - like this:

RewriteRule ^collection/(.*)  plug.php?e=tags&a=pages&t=$1 [QSA,NC,NE,L]


Dit bericht is bewerkt door Eugene (2012-03-08 06:14, 12 jaren ago)
Trustmaster
#4 2012-03-08 17:16

You don't need the .htaccess part, sef-urls.htaccess example serves this case easily.

May the Source be with you!
Eugene
#5 2012-03-09 16:59
#33477 Trustmaster:

You don't need the .htaccess part, sef-urls.htaccess example serves this case easily.

Hm... Of course, I'm using sef-urls.htaccess example, but I've put line with collection before index.php:

RewriteRule ^collection/(.*)  plug.php?e=tags&a=pages&t=$1 [QSA,NC,NE,L]

# All the rest goes through standard rewrite gateway
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]+) index.php?rwr=$1 [QSA,NC,NE,L]

How otherwise, I can reach collection URL? Index.php cannot see it as a plug (tags.php) and is not rewrite it by default...
 What's wrong - in my case???

Trustmaster
#6 2012-03-09 18:03

Ah, sure, my bad. One note though: use index.php instead of plug.php, the later is being phased out in non-legacy distributions.

May the Source be with you!
Eugene
#7 2012-03-11 06:51

ok. I done.

Do you mean that plug.php (which is empty by now) - will be deleted in future releases - like 1.0?

Trustmaster
#8 2012-03-11 14:50

It may be removed from packages for new installs and would be shipped in a separate legacy package.

May the Source be with you!