vocaliu / chrome-redirector

Automatically exported from code.google.com/p/chrome-redirector
GNU General Public License v3.0
0 stars 0 forks source link

[RULE] How to redirect to affiliate #12

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I am working a lot with affiliated sites, so your extension looks perfect. I 
would like the extension to behave as follows:
1) I type the URL I want to go to
2) Redirector matches a rule and redirects me to an alternate URL
3) That URL redirects me back to the original URL with some additions

Every time I try this, the site is al messed up

Can you make an example of a simple redirect, which only redirects once and not 
for every image or whatever?

For example: I want to go to www.bandolero.com. I have an affiliate URL like 
this: http://shop.bandolera.com/tradetracker/?tt=4880_167147_76521_&r=

I tried to make a new rule
Match type=wildcard, value= *.bandolera.com
Substitution type=wildcard, value = *
Replacement 
value=http://shop.bandolera.com/tradetracker/?tt=4880_167147_76521_&r=

If I use this, the result is al messed up!

Original issue reported on code.google.com by elstu...@gmail.com on 28 Mar 2012 at 1:32

GoogleCodeExporter commented 8 years ago
Attached debug file also

Original comment by elstu...@gmail.com on 28 Mar 2012 at 1:39

Attachments:

GoogleCodeExporter commented 8 years ago
I've attached a rule. Right click on the download link to import it.

Some explanations:
 * Redirector will always check every URL, so the only way to avoid unexpected redirection is to make the match pattern strict.

 * I personally deprecate the use of wildcard as it hardly reflects what you mean precisely; also note that when you wrote "*.bandolera.com", it would match the following URLs:
  ** http://www.bandolera.com/
  ** http://www.bandolera.com/index.php
  ** https://www.google.com/webhp&q=www.bandolera.com
So what you need here is the regular expression "^http://www\.bandolero\.com/$"

 * A loose rule to translate wildcard to regular expression:
  ** replace "*" with ".*"
  ** replace "?" with "."

Please let me know whether the rule works. Good luck!

Original comment by cws.de...@gmail.com on 29 Mar 2012 at 2:34

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks for responding. It does unfortunately not work for me :(
The rule tester says it works, but the browser does not do anything. Also, the 
debugger does not do anything.
Could you please see if this works for you? I changed the rule so it should 
redirect to google.com, which makes the redirect pretty visual ;)

I am using Chrome 18.0.1025.142

Attached the rule and my debug info

Original comment by elstu...@gmail.com on 29 Mar 2012 at 8:16

Attachments:

GoogleCodeExporter commented 8 years ago
I've verified it just now, and I captured a screenshot (in attachment).

I noticed you left out a slash (before "$") in the match pattern. It's 
invisible in address bar but actually always exists, e.g. when you see 
"https://www.google.com", it's "https://www.google.com/" in fact.

Please make sure you installed the rule I provided in the previous post. If 
that doesn't work, empty your browser's cache and test again.

One more thing to mention is that the debugger does not provide correct 
information sometimes. I'll fix it later.

Original comment by CyrilF...@gmail.com on 29 Mar 2012 at 8:36

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks, this works how it should be! I left the slash before the $ indeed. 
While rule-testing it did not match, so I removed it, I'm sorry ;)
Now works like a charm, also in debugger, thanks.

Extra question: how can I match both http:// and https:// 
I tried ^http.//: but that does not seem to work

Extra suggesions:
- add some (more) examples in your reference
- add a button for your extension in the toolbar
- add an icon in the url-bar to show one has been redirected by redirector

Thanks so far!

Original comment by elstu...@gmail.com on 29 Mar 2012 at 8:47

GoogleCodeExporter commented 8 years ago
> Extra question: how can I match both http:// and https:// 
Try "^https?://"

> Extra suggesions:
> - add some (more) examples in your reference
I'm conceiving it. This site was also set up for this purpose, since issues 
contain practical examples.

> - add a button for your extension in the toolbar
Redirector used to have a icon, however, I removed it as I thought it's 
annoying. I'll consider this.

> - add an icon in the url-bar to show one has been redirected by redirector
Someone else had the same suggestion, I'll try to implement it.

Original comment by CyrilF...@gmail.com on 29 Mar 2012 at 9:09

GoogleCodeExporter commented 8 years ago
Okay, thanks again!

>> - add a button for your extension in the toolbar
>Redirector used to have a icon, however, I removed it as I thought it's 
annoying. I'll consider this.
Maybe implement this as an option?

Original comment by elstu...@gmail.com on 29 Mar 2012 at 9:48

GoogleCodeExporter commented 8 years ago
I've fixed the bug with debugger and added an icon to the address bar (for 
notification only). Thanks for for your suggestions!

Original comment by CyrilF...@gmail.com on 1 Apr 2012 at 3:21

GoogleCodeExporter commented 8 years ago
Exactly what I wished for, thanks again.

Nice to have: I have a list of 300+ redirects. Cosmetic change: could you put 
the links to Backup/Restore to the top. Now I have to scroll long long way ;)

Nice to have: What happens if a Redirect hits an error 404 or 403 or something? 
I would like to see that Redirector then stops and loads the original match 
(and maybe change the icon to one with a red cross). Not a big issue for me, 
but here on my corporate network a few redirects through affialiate urls are 
blocked, so they stop and leave me with an unreachable page

Regards!

Original comment by elstu...@gmail.com on 2 Apr 2012 at 7:33

GoogleCodeExporter commented 8 years ago
> Nice to have: I have a list of 300+ redirects. Cosmetic change: could you put 
the
> links to Backup/Restore to the top. Now I have to scroll long long way ;)
Sure. I didn't thought someone would work with so long a list. BTW, I think you 
may shorten the list by merging some rules.

> Nice to have: What happens if a Redirect hits an error 404 or 403 or 
something? I
> would like to see that Redirector then stops and loads the original match (and
> maybe change the icon to one with a red cross). Not a big issue for me, but 
here on
> my corporate network a few redirects through affialiate urls are blocked, so 
they
> stop and leave me with an unreachable page
Error notification is in plan. I haven't come up with a satisfying scheme yet.

Original comment by CyrilF...@gmail.com on 2 Apr 2012 at 7:52

GoogleCodeExporter commented 8 years ago
For now I can disable those rules ofcourse.
Merging rules is almost impossible I think, just take a look at the very 
different URLS ;)

Original comment by elstu...@gmail.com on 2 Apr 2012 at 8:24

Attachments:

GoogleCodeExporter commented 8 years ago
A really complex list.

P.S. I've recently added the "Smart Wildcard" match type, you may write 
"^http://www\.123lens\.nl/$" as "http://www.123lens.nl/" from now on. It seems 
to be the type of wildcard most people want.

Original comment by CyrilF...@gmail.com on 2 Apr 2012 at 8:36

GoogleCodeExporter commented 8 years ago
Okay thanks, for making life simpler ;)

Original comment by elstu...@gmail.com on 2 Apr 2012 at 8:44

GoogleCodeExporter commented 8 years ago
As a follow up to our conversations: would it be possible to load a list of 
Redirector rules straight from a websource?
As you know by now, I have a long list of affiliate websites. Our foundation 
would like to promote these ones and your Redirector is an "install&forget" 
solution. But sometimes affiliates drop or we get some new URLs. To make sure 
everyone has an updated list, I can ofcourse offer them a new downloadable 
file, but a "dynamic list" of redirect rules would be more convenient! So: not 
a backup or import, but a "Load rules from URL".

Ofcourse we can host such a list on our server

Thanks again!

Original comment by elstu...@gmail.com on 7 Apr 2012 at 10:50

GoogleCodeExporter commented 8 years ago
Of course it's possible. In such case, rules are imported from a URL every time 
Redirector starts up. But it puts users in danger if malicious rules are 
provided.

I'll weigh the pros and cons before making a reply.

Original comment by CyrilF...@gmail.com on 8 Apr 2012 at 5:21

GoogleCodeExporter commented 8 years ago
I was afraid already for your comments about security... ;)
Yes I know the risk. For me personally: if I provide a backup-JSON for download 
or if I do it through URL, that's not a difference in security. In either case 
you should list the rules that are imported. Users can always decide for 
themselves if they trust the source.

Best practice in my opinion: import rules from URL as premier source. Reload 
every browser startup or scheduled. Must be possible to add extra rules. This 
also provides an option to override

I'll leave you to think about it ;)

Original comment by elstu...@gmail.com on 8 Apr 2012 at 10:49

GoogleCodeExporter commented 8 years ago
It's not at all difficult technically. I'll do my best to think up a most 
security scheme.

Original comment by cws.de...@gmail.com on 8 Apr 2012 at 1:17

GoogleCodeExporter commented 8 years ago
Thanks, would be great!

Original comment by elstu...@gmail.com on 8 Apr 2012 at 9:34

GoogleCodeExporter commented 8 years ago
Sorry to have kept you waiting for so long. I'm busy with other things these 
days.

The functionality you requested is implemented, please install the version in 
the attachment (this won't override your previous installation; you should 
uninstall it after testing).

Search for the "Remote rules" section and fill in a URL to see if it works.

Original comment by CyrilF...@gmail.com on 12 Apr 2012 at 7:06

Attachments:

GoogleCodeExporter commented 8 years ago
No problem Cyril, we all have our business ;)

Your new version works like a charm, perfect! I deleted all my rules and now 
import from http://www.ayubowan.org/media/files/redirector_chrome.txt
Our website doesn't support upload of json, but this txt extension works just 
as well.
Few minor remarks: 
- Redirect works, but the notification icon doesn't say "Treated by Redirector" 
anymore, at least not for URL imported rules.
- I don't see a list of what has been loaded, would be better
- And your new crx DOES install over my old version (which I think is OK!)

I'm happy, thanks!

Original comment by elstu...@gmail.com on 12 Apr 2012 at 7:31

GoogleCodeExporter commented 8 years ago
> Our website doesn't support upload of json, but this txt extension works just 
as well.
It's just a plain text file containing JSON data, any suffix will do (this may 
depend on your OS).

> - Redirect works, but the notification icon doesn't say "Treated by 
Redirector" anymore, at least not for URL imported rules.
The notification icon doesn't work as expected sometimes, I'll look into this 
issue later.

> - I don't see a list of what has been loaded, would be better
You cannot edit/delete remote rules, as changes will not be preserved.
So there's no plan to add a list to show remote rules; those who want it should 
import the corresponding file instead.

> - And your new crx DOES install over my old version (which I think is OK!)
It's strange. Did you install Redirector from this site instead of web store? 
They're of different IDs and should be treated as different extensions.

Original comment by CyrilF...@gmail.com on 12 Apr 2012 at 7:49

GoogleCodeExporter commented 8 years ago
Thanks for looking into notification icon sometime, agree with your opinion 
about showing rules.

Installed Redirector from Downloads tab on this site, not from store. 
Attachment on your previous message did not work, it just downloaded and was 
not recognized by Chrome ;)

Original comment by elstu...@gmail.com on 12 Apr 2012 at 7:59

GoogleCodeExporter commented 8 years ago
Hi Cyril... could you please look into your extension? My redirects don't work 
anymore. Got them loaded through url. Also debugger shows no redirects. All 
options look fine, redirector is not disabled etc. I'm pretty sure it worked 
yesterday...!

Regards

Original comment by elstu...@gmail.com on 13 Apr 2012 at 7:31

GoogleCodeExporter commented 8 years ago
I haven't release any updates since yesterday, and it still works here.

Please provide the following information:
 1. Is the notification icon a normal one?
 2. Does context menu indicate Redirector is enabled?
 3. Does it work after reload?

Original comment by CyrilF...@gmail.com on 13 Apr 2012 at 7:39

GoogleCodeExporter commented 8 years ago
1. Icon is normal, blue, no red crosses or something
2. Yes it does
3. Nope

I did uninstall and reinstall, close browser etc.
I'm working with Chrome 19.0.1084.15, since today I believe, if that matters. I 
will try on another workstation this weekend, maybe it's my local 
configuration...

Original comment by elstu...@gmail.com on 13 Apr 2012 at 7:52

GoogleCodeExporter commented 8 years ago
Try steps below to see if more details can be found:
 1. Open the "Extentions" tab in "Settings" of Chrome
 2. Select "Developer mode"
 3. Click the link "Inspect views: html/background.html"
 4. Select "Console"
 5. Is there any thing there (like error message in red)?
 6. Be [5.] not true, type in "$v.ruleAuto" and <Enter>. What's the output?

Original comment by CyrilF...@gmail.com on 13 Apr 2012 at 7:59

GoogleCodeExporter commented 8 years ago
Nothing there, no error message, so that's fine.
$v.ruleAuto gives me an array with 331 elements, all like this:

306: Object
content: undefined
decode: false
match: /^http://www\.travelhorizon\.nl/jQuery/
repl: "http://ds1.nl/c/?wi=110736&si=522&li=34087&ws=&dl="
sub: /.*/
__proto__: Object

Looks fine to me

Original comment by elstu...@gmail.com on 13 Apr 2012 at 8:11

GoogleCodeExporter commented 8 years ago
Aha... I see...! all url's have the addition jQuery all of a sudden. In the 
source also, that's strange, I'll look into that myself, sorry! ;)

Original comment by elstu...@gmail.com on 13 Apr 2012 at 8:14

GoogleCodeExporter commented 8 years ago
So I think Redirector should be more friendly on error prompts.

Original comment by CyrilF...@gmail.com on 13 Apr 2012 at 8:18

GoogleCodeExporter commented 8 years ago
I know now what caused it. I changed my script to generate the rules. It had to 
run in noConflict mode, so I changed every $ statement to jQuery, which also 
changed the rules ;)
Thanks for helping me out! And this is no fault of Redirector, because my match 
was perfectly valid

Original comment by elstu...@gmail.com on 13 Apr 2012 at 8:24

GoogleCodeExporter commented 8 years ago
Oh, could you please publish the latest version in the Chrome store? So I can 
provide people with a correct version for downloading, thanks!

Original comment by elstu...@gmail.com on 13 Apr 2012 at 10:05

GoogleCodeExporter commented 8 years ago
Did you mean 2.2.20.8? I published it yesterday.

Original comment by CyrilF...@gmail.com on 13 Apr 2012 at 10:10

GoogleCodeExporter commented 8 years ago
Sorry, checked yesterday when it still had the old version ;)
You're right, it's published, thanks

Original comment by elstu...@gmail.com on 13 Apr 2012 at 11:21

GoogleCodeExporter commented 8 years ago
Hi Cyril, could you please help me with this redirection?
I want to substitute this url:
http://api.affinesystems.com/query_line_item?url=http%3A%2F%2Fdev%2Eadap%2Etv%2F
sxu%2Fadaptvjw5%2Ftestfile%2Ehtml%3FadaptvadSourceOverride%3D9598%26adaptvocb%3D
56649%26adaptvglobalFilterSuppress%3Dtrue%26adaptvpageUrl%3Dnfl%2Ecom&line_item_
id=42&key=3ce782967527dfa62c239086fa61621df2575004

into another one, say:
http://www.google.com

when i edited the rule, the test url show right replacement, but when I run it 
or use the debugger, it was not redirected.

my rule is attached.

Thanks in adavance!

Original comment by ang...@adap.tv on 14 Jun 2012 at 5:52

Attachments:

GoogleCodeExporter commented 8 years ago
A working rule is attached, and it seems to be the same with that of yours. You 
may need to attach the .json and .dbg file if it doesn't work.

Original comment by CyrilF...@gmail.com on 15 Jun 2012 at 3:47

Attachments:

GoogleCodeExporter commented 8 years ago
thanks a lot, your .json file is working for me now.

Original comment by ang...@adap.tv on 15 Jun 2012 at 5:37