Home Forum
2017-11-18
Menu principale
Prodotti
Giochi a premi
Accedi ai servizi
Newsletter
Ricezione
Benvenuto, Ospite
Nome Utente Password: Ricordami

problem with GET parameters
(1 Online) (1) Ospite
  • Pagina:
  • 1
  • 2

ARGOMENTO: problem with GET parameters

problem with GET parameters 6 Anni, 1 Mese fa #2652

  • kraej
  • Offline
  • Fresh Boarder
  • Messaggi: 14
Hey there,

I am using ReDJ 1.5.6 Enterprise in a Joomla 1.5 environment. Everything's good so far...

But: I have problems using ReDJ with a GET-parameter in the url.

Example:

301: From "en/tournament-description\?t_id=1" -- To "en/tournament-title"
200: From "en/tournament-title" -- To "en/tournament-description\?t_id=1" (just to get a nice looking URL)

The page "tournament-title" includes a php-script which needs the t_id to load the contents from a database.

This works so far. It also works for the id 2-9. BUT: if the t_id is 10-19 it always redirects to the t_id = 1


To see it live, just have a look at dev.komm-mit.com/en/tournaments/spain/trofeo-mediterraneo and try clicking "Friendship Trophy" in the menu on the left side.

Hope anyone can help?! =)

Cheers,
Jochen

Re: problem with GET parameters 6 Anni, 1 Mese fa #2656

  • admin
  • Offline
  • Administrator
  • Messaggi: 1603
Hi Jochen,
of course I can help you, but is not so clear how you manage the get parameter in the FROM and TO URL.

Could you, please, tell me an example of a full source URL and the corresponding full destination URL? In this way I can help you to create a redirect rule that works for your needs.

Let me know,
Luigi

Re: problem with GET parameters 6 Anni, 1 Mese fa #2658

  • kraej
  • Offline
  • Fresh Boarder
  • Messaggi: 14
Hi Luigi.

Thanks for your fast reply!

I have an redirect 301

FromUrl dev.komm-mit.com/en/tournament-description?t_id=1

ToURL dev.komm-mit.com/en/tournaments/spain/trofeo-mediterraneo


in addition I do use an internal 200

FromURL dev.komm-mit.com/en/tournaments/spain/trofeo-mediterraneo

ToURL dev.komm-mit.com/en/tournament-description?t_id=1


I do it that way, because it enables the possibility to set links to "dev.komm-mit.com/en/tournaments/spain/trofeo-mediterraneo" which looks better in a link-context.

As I mentioned, the php script needs the t_id to get the content.

But: If I use a t_id between 10 and 19 it always redirects to trofeo-mediterraneo.
It seems as if the 301 redirect only acceppts the first character of the t_id .. ?! :-S

Thanks so far!
Jochen

Re: problem with GET parameters 6 Anni, 1 Mese fa #2659

  • admin
  • Offline
  • Administrator
  • Messaggi: 1603
Hi Jochen,
please tell me if I understand your request. You would like to have EVER this "friendly" URL:

dev.komm-mit.com/en/tournaments/spain/trofeo-mediterraneo

But this should show the content of these pages:

dev.komm-mit.com/en/tournament-description?t_id=XX

Where XX changes for any call.

Is it so?

Cheers,
Luigi

Re: problem with GET parameters 6 Anni, 1 Mese fa #2660

  • kraej
  • Offline
  • Fresh Boarder
  • Messaggi: 14
Hi Luigi.

sorry for not being clear enough .. ;-(

I do have a list of 20 tournaments with 20 different tournament titles.

I would like to have 20 different URLs (1 for each tournament). So I need a matching URL for each t_id.


For the moment the problem is that all the tournaments with t_id 10-19 are redirected to trofeo-mediterraneo (id=1), although I set the matching rules for all the t_ids.

_____________________________________________________
I have this rule set:

301
FromURL /en/tournament-description?t_id=xyz_id
ToURL http://{siteurl}/en/tournaments/spain/XYZ

200
FromURL /en/tournaments/spain/XYZ
ToURL http://{siteurl}/en/tournament-description?t_id=xyz_id

for all of my tournaments from id=1 to id=20.
I do have the 301 because the menu links to the URL tournament-description?t_id=xyz_id ...

_______________________________________________________

I hope this helps?

Cheers,
jochen

Re: problem with GET parameters 6 Anni, 1 Mese fa #2661

  • admin
  • Offline
  • Administrator
  • Messaggi: 1603
Ok,
now is cristal clear. There's a little problem bu we can solve together.

Problem is that in the original (source) URL you have a title (e.g. trofeo-mediterraneo), while in the destination URL you need its ID (e.g. id=1 for trofeo-mediterraneo). So, you need a way to associate the first information to the second one.

The "poor" solution is to create a rule for each tournment. In this case you know the association id->title and any rule is like this:

From URL: /en/tournaments/spain/XYZ
To URL: http://{siteurl}/en/tournament-description?t_id=xyz_id
Redirect: 200


But even in this case you don't need a double redirect. Why you need the 301 redirect? Drop it. And if you need for a reason, it's wrong. You should manage rule order or use regular expressions (a simple dollar at the end will save your life):

From URL: /en/tournament-description?t_id=xyz_id$
To URL: http://{siteurl}/en/tournaments/spain/XYZ
Redirect: 301


Now the good news...

You could use macros to create a single universal rule valid for any tournment. Just like that I can think of at least two solutionsp in mind:

1) If you could change the original URL adding the id info you could do this without any ReDJ changes:


dev.komm-mit.com/en/tournaments/spain/1-trofeo-mediterraneo
dev.komm-mit.com/en/tournaments/spain/2-title2
...
dev.komm-mit.com/en/tournaments/spain/x-titleX

2) We can add a new custom macro that allows table lookup (it's planned for next release). So, you could specify the query to get the id from the title. This is the coolest one, but you should wait a little for next release...

Cheers,
Luigi

Re: problem with GET parameters 6 Anni, 1 Mese fa #2664

  • kraej
  • Offline
  • Fresh Boarder
  • Messaggi: 14
Hi Luigi,
thanks again.

I sorted out that it depends on the ordering. If I set the tournament with the ID 1 behind 1-19 it works.

Nevertheless it is not the easiest solution.. I think better would be a redirection following this scheme:

 
FromURL /en/tournaments/spain/trofeo-mediterraneo
ToURL http://{siteurl}/en/tdetails?t=trofeo-mediterraneo
Type 200
 


This would be kind of smart.
BUT: As I don't want to setup rules for 20 tournaments in 6 languages ... is it possible to use placeholders in the FromURL and ToURL like I can do in htaccess?!

I tried

 
FromURL ^(.*)/tournaments/spain/(.*)$
ToURL http://{siteurl}/$1/tdetails?t=$2
Type 200
 



Is it possible? Do you know what I mean?


Cheers,
jochen

Re: problem with GET parameters 6 Anni, 1 Mese fa #2666

  • admin
  • Offline
  • Administrator
  • Messaggi: 1603
Yes,
it's possible but ReDJ placeholders are a little bit different.

In the from url all is right, because this can be a regular expression. In the destination url things are a little bit different. ReDJ supports "macro" than can take parts of original URL and replace in the destination "at run-time".

In the next version there will be support for more macro, including $X pattern from the "from url".

Meanwhile, it's easy to do this for you because with Enterprise version you have preg_match macro.

Just gimme time to create and test a rule for you.

Luigi
Ultima modifica: 6 Anni, 1 Mese fa Da admin.

Re: problem with GET parameters 6 Anni, 1 Mese fa #2674

  • admin
  • Offline
  • Administrator
  • Messaggi: 1603
Here I am,
sorry for delay but I've a lot of work in these days.

Create an item as follow:

From URL: /tournaments/spain/
To URL: http://{siteurl}/{preg_match 1}/\/([^\/]+)\/tournaments\/spain\//i{/preg_match}/tdetails?{preg_match 1}/\/tournaments\/spain\/(.*)/i{/preg_match}


It should work. Let me know.

Cheers,
Luigi

Re: problem with GET parameters 6 Anni, 1 Mese fa #2675

  • kraej
  • Offline
  • Fresh Boarder
  • Messaggi: 14
Hey Luigi,
thanks again. This looks good and it does work!

Just another one ... sorry for being annoying

Is it also possible to rewrite an URL like

 
FromURL (.*)/tournaments/(.*)/(.*)
 
 

I played around with the pregmatch, but I did not find a solution ... otherwise I will just setup the rules manually (for the moment there are 8 countries) ...

Cheers!
  • Pagina:
  • 1
  • 2
Moderatori: admin
Tempo generazione pagina: 0.55 secondi
News
Cerca con Google
Chi è online
 73 visitatori online
Sponsor

Slotmachineaamsonline.com è una guida alle migliori slot machine online legali in Italia. Sul sito trovi un elenco sempre aggiornato dei casino online con Slot machine e bonus slot, le ultime novità dal mondo delle slot online e le migliori strategie per vincere. Inoltre, è disponibile una sezione dedicata alle slot machine da BAR che finalmente sono disponibili nella versione online.