ModX friendly url has a bad format - friendly-url

Sorry, this is probably a very basic question, but I'm new to ModX and haven't been able to find an answer.
I am trying to get friendly urls working, but right now, all my urls are showing up like
http://localhost/modx/modx-2.2.13-pl/"http://localhost/modx/modx-2.2.13-pl/other.html
instead of the expected
http://localhost/modx/modx-2.2.13-pl/other.html
I probably don't have some system setting set correctly; any help would be greatly appreciated...

Sounds like you've forgotten to add
<base href="[[++site_url]]" />
To your head.
At least that is the first thing that comes to mind.

Sounds like you're generating the links with full path, are you doing them yourselves or is it Wayfinder or some snippet? And why do you have a " there in the middle of the string?
The basic idea is to use a base_href consisting of your root, http://localhost/modx/modx-2.2.13-pl/, and then construct links like [[~[[+idToPageYouWantToLink]]]].

Related

How do I check if certain text exists on a page (puppeteer)

Sorry in advance if I seem kinda clueless, I just started using puppeteer yesterday and I’m inexperienced with this kinda stuff.
I’m trying to check if a certain page (opened with puppeteer) has the phrase “hello” for example, keep in mind that I know the XPath of the text (if it exists). I’ve tried .waitForXPath() but I can’t seem to get it to work. Is there an easier function for this?
(await page.content()).match('hello')
That depends on what you typed into .waitforXPath() method.
I can imagine this can work:
await page.waitForXPath("//*[contains(text(), 'hello')]");
But it might be slow because all texts of all elements will be searched. It's better to narrow down the search to e.g. some elements. Unfortunately you don't provide more specifics, so I can't help you there.

How to rewrite URL ".com?foo=bar" TO ".com/bar " and still get the value of $foo

I have this site, Basilica, which is based on a WP template.
http://www.bazylikaswidnicka.com/wirtualnie/?pan=pan_szopka
I added some PHP stuff to it and the site apparently gets hurt by that ( seo wise ), especially by the section of virtual tours.There I used the ol' good fashioned PHP, structural in form, to catch what a viewer wants to see.
I would like to be able to change the following address:
http://www.bazylikaswidnicka.com/wirtualnie/?pan=pan_szopka
to:
http://www.bazylikaswidnicka.com/wirtualnie/pan_szopka
yet still be able to catch the value of $pan. How do I do that?
The .htaccess is already in place by default, it changes all the other links, how do I add this trickery to an extra value in the url to make wonders for this small portion of the website, too?
I don't expect you to write a script for me, but if you can give me a little nudge to where I should turn to that would be enough.
As far as I know you can't do this. You would need to provide anything you wish to allow the page to have access to to be in the URL.
If you are talking about simply retrieving the value from the url then you can do something like
$URLPartList = explode('/', $_SERVER['REQUEST_URI']);
$pan = $URLPartList[1];

Removing ids from url [duplicate]

Hey guys! Working on a new Cake app and wondering if there is anyway for me to remove the ID-in-URL routing from Cake. Perhaps by passing the ID in POST somehow? Having the ID passed in as a URL param just seems really shoddy and unsafe. Thanks!
"Shoddy"? It's standard practice and a perfectly fine solution to have ids in the URL. Look at the URL of your question:
http://stackoverflow.com/questions/4638262/removing-id-from-cakephp-url
^^^^^^^
id
Also, there's absolutely nothing unsafe about showing an id in a URL. It's just a number that doesn't mean anything. If a user can do something "bad" only by knowing this id, your app is broken and insecure, not the id-passing mechanism.
Trying to work around this scheme means working around the fundamental principle of the HTML protocol and opens up a whole new can of worms.
Some people prefer using slugs instead of primary key ids. This is the removing-id-from-cakephp-url part of the URL from this page. Take a look at the SluggableBehavior.
However, slugs can change. Hence, having the primary key in your URL is useful if you want to have a permalink. StackOverflow does both so that it can support both permalinking from other sites, as well as for SEO reasons. :)
Regarding security issues, I guess the other answers have already pointed out that there are other ways to make your application secure.
Why do you care? URL-s are optimized for SEO reasons, an ID won't matter if it's ain't too long. If the latter, consider using a shorter one with numbers and letters in them instead, it will be as difficult to guess as a long one with just numbers.
If you are not using GET and you do not supply the params in the URL, your users won't be able to copy-paste the location.

What's the recommended approach for hierarchical URLs in Orchard?

I'd like to have a hierarchical URL structure in my site. Something on these lines:
tutorials
javascript
jquery
There should be a page at each level (tutorials, tutorials/javascript and tutorials/javascript/jquery). Obviously, using Taxonomies would help me organize my content in this manner, but how do I get Autoroute URLs generated for this scenario?
Bertrand Le Roy made a comment on this SO answer about using taxonomy terms as pages but it still doesn't seem to create the right URL structure for me. Am I missing something? Is there something specific I need to configure or enable to make this happen?
Are there any other approaches I can look at?
I was thinking of specifying the default route as something like {Content.Fields.Page.TaxonomyName}. It appears that this isn't really possible right now according to this bug report.
Here's an approach that seems to work without having to use taxonomies:
I added a Content Picker field called ParentPage to the Page content type and updated the Page's Autoroute default to
{Content.Fields.Page.ParentPage.Content.Path}/{Content.Slug}
Now in each page I get to pick what the parent page is and the URL is constructed how I expect it. From what I remember of working with WordPress, I think this is pretty close to how it allows you to do this parent page thing, too.

How can I make clean search urls?

If I have search that has a lot of different options, then url becomes very long and looks very bad. Is there anyway to make urls look better? Using POST to make search would keep urls clean, but people couldn't share search urls.
Try doing an advanced search with many options on Google: the URL is long and not especially human-readable. I really don't think that's a problem; I don't think many people read URLs often. If you expect people to share search results, then show a button on the search results page that will generate a tinyURL-style shortened URL for that particular query.
A POST is meant for something that changes server state (e.g. a database update) and really shouldn't be used for a search.
You can encode all of your search criteria into something like a hash and then have a single parameter in your querystring that has that value:
http://www.mysearch.com/query=2esd32d2csg3fasfdlkjSDDFdskjsEWFsDFFR39fdf
I'm not sure exactly how you'd encode everything, but it wouldn't be too difficult.
Do the different options actually need to be in the URL? For example, a quick search from my Firefox search window gives a URL like:
http://www.google.com/search?q=search&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a
If I'm sending the link to anyone, I habitually cut off everything after q=search. Why not have the URL be the bare minimum that you need to send the link to someone (or bookmark), and make the rest as invisible POST variables?

Resources