I want to remove all numeric fragments of the url on the third position, if the first fragment matches a single string xxxx.
Example:
example.com/xxxx/hello/1
should become
example.com/xxxx/hello
and
example.com/xxxx/hello/1/anything
should become
example.com/xxxx/hello
but
example.com/xxxx/hello
example.com/abcd/hello/anything
example.com/xxxx/hello#12
should be kept unchanged.
Related
I am charged with maintaining some old code, in which we are extracting a Notes link from a message, and turning it into a link that can be called from HTML on a local machine (on which Notes is installed). We have a situation where one link works, and another one does not.
I am struggling to understand what exactly this code is doing, and why it even works in the first place. Basically, we are looking at the property "$Links" in an email message. The value of this property, for example, when viewed in Notes, is something like:
RFC2257F23:004852B9
VFA5208C4C:6552DA01-VN422569FB:003AAC2D
NF6D24A297:6579B8E3-NNC225805D:004D8678
What our code does is get the binary value of this property, using NSFItemInfo and OSLockBlock. It then starts at offset 11, and works backwards 8 bytes, converting each byte to a 2 digit hex value. Then it does the same thing 3 more times, but moving the offset 8 bytes forward from the original 11. A '/' character is inserted after the 1st and 3rd of these 8 byte segments. Then the whole thing is appended to "notes:///". At the end, the link generated looks like this:
Notes:///C2257F23004852B9/A5208C4C6552DA01422569FB003AAC2D/6D24A2976579B8E3C225805D004D8678
I'm guessing that this value represents the Notes UNID of the document link, and that when clicked on, Notes
starts up, and goes directly to the document. So does anyone have an idea as to why one link would work, and
the other fail? Our customer claims that the Notes links database is intact, and can be viewed successfully
from within Notes itself.
Notes- Links consist of the protocol, a server part, a database part and the element within the database.
A normal example would be:
notes://server/path/database.nsf/view/keytodocumentinview
Every part (except the server) can be replaced by an internal ID.
path/database.nsf --> Replica ID (C2257F23004852B9 in your example)
view --> Universal ID of the design element of the view (A5208C4C6552DA01422569FB003AAC2D)
keytodocumentinview --> Universal ID of the document (6D24A2976579B8E3C225805D004D8678)
If there is no server in the link, then the notes client tries to "guess" the right server. It checks:
Is there an icon in the desktop for the Replica- ID requested. If yes: take the server of the last used replica (on the top if replicas are stacked)
Can I find a catalog.nsf (either on catalog- server from location document or on mail- home- server. If yes: Is the replica- id in there? If yes: Take the server from there...
Ask user for server (not sure about that part, as it not always seems to happen)
So the answer to your question is:
If the client can not find any reference to the server the link will not work.
So it is always better to add the right server to the link (if you know it).
Just to explain, how to get from one form to the other, here is some more explanation:
Some times these IDs are represented differently as found in the $Links- Item:
The first letter stands for the "Type" of ID:
R = Replica ID
V = View Universal ID
N = Note Universal ID
All 32Bit values are separated in 2 halfs of 16 bit, prepended by another Character telling "First" (F) or "Second" (=Next, N) value.
The rest is divided in chunks of 8 letters, the first and third octet separated with colons, and the first half and second half split by a minus sign.
Like that you can easily see:
RFC2257F23:004852B9 translates into FC2257F23004852B9
VFA5208C4C:6552DA01-VN422569FB:003AAC2D translates into A5208C4C 6552DA01 422569FB 003AAC2D
and
NF6D24A297:6579B8E3-NNC225805D:004D8678 translates into 6D24A297 6579B8E3 C225805D 004D8678
I know that url_rewrite using .htaccess requires an identifier in the pretty url by which we identify the page/link to load. But, here are a few examples where i can't make out the identifier.
Any ideas how do they do it?
http://techcrunch.com/2014/03/15/julie-ann-horvath-describes-sexism-and-intimidation-behind-her-github-exit/
http://techcrunch.com/2014/03/15/why-we-hate-google-glass-and-all-new-tech/
In both the examples above, the portion http://techcrunch.com/2014/03/15/ is constant. Any ideas on how to do this would be welcome.
There's a lookup based on the "category" and "page name". It uses both "2014/03/15", or the date, as well as the name of the post, "julie-ann-horvath-describes-sexism-and-intimidation-behind-her-github-exit" to fetch the dynamic content. This makes it so you wouldn't really need an ID unless you happen to have 2 posts with the exact same title on the same date. The fetch from the database is a little more complicated with this method, since the title in the URL isn't always going to be the title in the database because the title text needs to be cleaned of special characters and spaces so that it reads nicely within a URL. For example:
/whats-with-all-of-these-titles-in-urls/
Could have a page title: "What's with all of these titles in URLs"
So you can see the ' is removed, the spaces are changed to -'s and everything is made lowercase. CMS's handle this by creating what's called a "slug". The "whats-with-all-of-these-titles-in-urls" title is the "slug" while the real title is "What's with all of these titles in URLs". The slug is stored alongside the title in the database, and is ensured to be unique, at least within each category. This way, the slug is sort of like a numerical ID and is used, along with the category (but not necessarily), to fetch the page content from the database.
Our customers post links to our site on various social media sites. The query string looks like this:
?jid=6559&hjid=754BCDF775239471EB69054403DD9AB6
However a small number of requests have an invalid query string when posted back to us. Here are some examples:
?jid=655975&hjid=75477OPQS77523947131RO6905440336QQ9NO6
?jid=655945&hjid=75441OPQS77523947125RO6905440344QQ9NO6
You can see that all the numbers are left untouched and the letters in the query string values are changed. The invalid values also seem to all follow the same pattern where A-Z values are changed and numbers are left intact.
All of these requests come from the same IP address ranges:
209.133.77.163-168
89.145.102.202-207
It looks to be some sort of URL fuzzing service. Has anyone seen behavior like this before? If not any ideas on the pattern of the changes?
I'm having an issue where a third "segment" in the url will cause ALL the exp:channel:entries to stop returning results.
Example URLs:
works fine: siteurl.com/index.php/one/two
does not work: siteurl.com/index.php/one/two/three
Example Entry Pull:
{exp:channel:entries channel="my_channel" category="18" sort="asc" search:show_toggle="=SHOW" orderby="sort_order"}
Is this some kind of injection that I am unaware of. I have searched through the documentation, and from what I can tell my specification of a category should overwrite anything in the url. I may be botching it up, but there HAS to be something I can do.?
Something I can modify in the channel module?
Without using the dynamic tag parameter in your Channel Entries tag, ExpressionEngine is expecting a URL Segment Variable to contain the Entry ID or URL Title of your entry.
Since the third URL Segment /index.php/one/two/three isn't a numeric Entry ID or URL Title, your Channel Entries query doesn't contain any information.
By setting dynamic="no" you will ensure that the list is not affected by anything passed in the URL.
Since you've written an extremely specific Channel Entries Query, be sure to add dynamic="no" to your {exp:channel:entries} tag loop to have ExpressionEngine ignore the URL Segments and instead use the parameters you supply:
{exp:channel:entries channel="my_channel" dynamic="no" ...}
...
{/exp:channel:entries}
Furthermore, by adding a simple Conditional Variable to your code, you will be able to see a message when no results are returned:
{exp:channel:entries channel="my_channel" ... }
{if no_results}Sorry, No Results{/if}
...
{/exp:channel:entries}
Grokking the fundamental ExpressionEngine's URL concepts and URL Segments is important to understanding and troubleshooting issues like this.
ExpressionEngine looks at the segments which follow /index.php/ as the following:
the first segment is assumed to be the template group
the next segment is assumed to be the name of a template within that template group
the third segment is assumed to be either the url_title of an entry, or, if the segment is numeric, the entry_id of an entry
So, in your case, EE is looking to load the two template, from the one template group, and then display the entry from the my_channel channel that's in the category with the ID of 18 and has a url_title of three.
Your specification of the category only overwrites any category information in the URL. (e.g., /template_group/template/category/doorstops or /template_group/template/C10 would not affect which entries get displayed in your example).
If you want your {exp:channel:entries} tag to ignore the URL completely (with the exception of pagination), you can add dynamic="off" to your tag parameters.
Client need SEF URL for e-commerce site (ISS 6). We tried IonicIsapiRewriter and it works good.
Now consider the below url,
www.store.com/product/12345/men_tshirt.html
This works fine. I write the rule to pass the id as query string (product.action?prt_id=12345)
But client wants the URL to be
www.store.com/product/men_tshirt.html
How to do this? Without passing product id how to identify the product?
In order to get this working as expected, the men_tshirt part needs to be the new ID to identify the resource that was formerly identified by 12345. So men_tshirt needs to be a unique value in that context.
Then you just need a mapping of those textual IDs onto numeric ID.