Recommended Posts

@rareyush My apologies for the late response here. Haven't had a chance to look into it yet. What is the domain of the new site? Is it live at the moment? Thinking I'd need to take a look and see what happens - if you could provide some more info. Thanks!

Share this post


Link to post
Share on other sites
On 9/23/2018 at 8:26 AM, Mike Rockett said:

@panx Thanks for the report – please could you have a look in your server logs to see what the error is?

@Mike Rockett [Wed Sep 26 11:27:17.253274 2018] [core:alert] [pid 13619] [client **] /home/httpd/vhosts/**/.htaccess: Invalid command 'RewriteCond\xef\xbb\xbf', perhaps misspelled or defined by a module not included in the server configuration, referer: https://**/pw/setup/jumplinks/

I don't get this properly done - lack of knowledge of .htaccess coding. Please don't ask me for the current htaccess code, it's rubbish.

How can I rewrite the original URL to the deseried URL?

Original URL:
/index.php?reference=kunststoff&object=1
/index.php?article-group=a&article-number=101.030

Desired destination URL:
/reference/kunststoff/object/1
/article-group/a/article-number/101.030

With this desired destination URL, i will be able to pass through jumplinks to reach the final URL.

Share this post


Link to post
Share on other sites

@panx - looks like there might be an encoding issue with the RewriteCond directive there... Not sure how it would have happened, but my best guess would be to type the directives in manually.

Also, the second RewriteCond line in that state won't apply to you. You'd likely need a catch-all of sorts to match the different types. I'm not able to test this as I no longer use Apache, but this could work:

RewriteCond %{REQUEST_URI} ^\/index\.php [NC]
RewriteCond %{QUERY_STRING} ^(.+)$ [NC]
RewriteRule ^ /index_php/%1? [R,L]

From there, you'd be able to create a jumplink for index_php/reference={reference:segment}&object={object:num}, which could then be directed to reference/{reference}/object/{object}.

  • Thanks 1

Share this post


Link to post
Share on other sites

@Mike Rockett thank you for your help!

With the following modification, I was able to do the jumplink stuff.

RewriteCond %{REQUEST_URI} ^\/index\.php [NC]
RewriteCond %{QUERY_STRING} ^(.+)$ [NC]
RewriteRule ^ /index2.php?%1? [R,L]
  • Like 1

Share this post


Link to post
Share on other sites

I am experiencing problems when the source URL contains '('.

So, it works when I use 'something.html' as source, but when using 'something-(other).html' I get this error:

Not Found

The requested URL /something-(other).html was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


Apache/2.4.34 (Win32) OpenSSL/1.0.2o PHP/5.6.37 Server at es-local Port 80

I have a couple of old links that use '(' and would rather not mess with .htaccess. 

I have checked "Turn debug mode on" but nothing changes

Appreciate your help...

Share this post


Link to post
Share on other sites

Also, how would you strip a ',' from the link? PW doesn't seem to allow those, but I have them in previous links...

Share this post


Link to post
Share on other sites

@Mike Rockett

// Get the correct table name for ProcessRedirects
        $redirectsTableNameQuery = $this->database->prepare('SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = :db_name AND TABLE_NAME LIKE :table_name');
        $redirectsTableNameQuery->execute(array(
            'db_name' => $this->config->dbName,
            'table_name' => $this->redirectsTableName,
        ));
        if ($redirectsTableNameQuery->rowCount() > 0) {
            $redirectsTableNameResult = $redirectsTableNameQuery->fetch(PDO::FETCH_OBJ)->TABLE_NAME;
            if ($this->redirectsTableName == $redirectsTableNameResult ||
                strtolower($this->redirectsTableName) == $redirectsTableNameResult) {
                $this->redirectsTableName = $redirectsTableNameResult;
            }
        }

Mike, why are you doing this? And why are you doing this in the constructor? As far as I can see it is just used in the "___executeImport" function. Which I suspect is called only once when doing whatever kind of import that is.

I don't even have that table in my database. Yet as the code is placed in the constructor every time a page is called there is this request to information_schema. This leads to a high database load due to a lot of permission requests.

I suspect you can move that to the import function?

Share this post


Link to post
Share on other sites

@DarsVaeda – Thanks for bringing that up. I did indeed plan to move it some time back, but then decided to only do it for v2, which, hasn't been under active development of late. I'll try find some time to sort this out on v1 soon. Sorry for the issues caused here. 🙂

@gr00__ (sorry, not sure why it's not tagging you) – That would likely be due to PW’s htaccess rules, as the error is coming from Apache. As that's where its coming from, you'd need to create a rule that will strip out those characters. Haven't worked with htaccess for a long time now, so not confident that I can assist accurately…

Share this post


Link to post
Share on other sites
On 10/27/2018 at 6:46 PM, Mike Rockett said:

@DarsVaeda – Thanks for bringing that up. I did indeed plan to move it some time back, but then decided to only do it for v2, which, hasn't been under active development of late. I'll try find some time to sort this out on v1 soon. Sorry for the issues caused here. 🙂

I've just moved it down to the function without anything popping up in error log. Load is down by 90% at least, site speed has improved dramatically as well. I'd suggest you really look into this asap 😉

  • Like 2

Share this post


Link to post
Share on other sites

Can the module redirect to destination including query strings or anything after the / for example? I have tried numerous things but no joy. Having to do this in .htaccess:

RewriteRule ^old-page/(.*) /new-folder/new-page/$1 [L,R]

Cheers. 

 

 

Share this post


Link to post
Share on other sites
On 12/8/2018 at 10:04 AM, Mike Rockett said:

@cb2004 – https://jumplinks.rockett.pw/features/smart-wildcards.html – you'll probably want to use {segments} or {all} here. 🙂

That done the trick, I had to turn off cleaning for things like ?utm_source=X&utm_source=Y. What caught me out here was page:1000{all} didn't work, fine once I realised though.

Share this post


Link to post
Share on other sites

We've had some issues redirecting urls that include a tilde (~/media/) in it.  We are moving over a site that makes heavy use of urls like that from the previous version.  Is this something we can handle with jumplinks or do we need to try to do that in the .htaccess?  We can get the URL to show in the list, but Jumplinks will never register a hit against it.  Do you have a recommendation on how to handle urls like this?

 

Thank you!

Share this post


Link to post
Share on other sites

Hi Mike

When creating a jumplink, there's a link to your site for examples.

Currently generating a 404 error

 

Share this post


Link to post
Share on other sites
6 minutes ago, Mike Rockett said:

Indeed - 1.5.50 has the correct links. 🙂

Good excuse to use Jumplinks here 🙂

Share this post


Link to post
Share on other sites
Just now, Peter Knight said:

Good excuse to use Jumplinks here 🙂

Haha, if only the site site was PW-powered. It's just a lander running on Netlify. Might add in some sort of wildcard redirect to the new docs home. 🙂

Share this post


Link to post
Share on other sites

Don't have a chance to look into this right now, but is anyone having issues on PHP 7.3? Saw a comment on the module listing from Alex Capes about it breaking. In the meantime, I've opened up an issue over at GitLab: https://gitlab.com/rockettpw/seo/jumplinks-one/issues/1

@Karinne Cyphers - only saw your note now, sorry about that! It's likely due to rules 16a/16b in htaccess. 16a limits the characters allowed in a URL, so hits would never even boot up ProcessWire. Try changing to 16b (and adding the tilde if it's not there).

 

———

Future Development / v2

I profusely apologise for how long it's taken to get things done for v2. As some of you know, my daily responsibilities have taken over, and committing time to open-source projects is not there as it once was. I'd love to be able to say that I can try find some time to get to it, but it's simply a promise I can't make or keep, unfortunately…

The way I see it, there are two options on the table. First is to wait it out (I know, I know…) – I do have a project board on the old repo, so I know what stands where and what I'd envisioned for the module, and can pick things up where I left off last (phew, haven't touched jQuery in forever – that might be a challenge), when the time avails itself. Technically, I'm about half way there but there's still quite a bit of work to do in terms of frontend. Second option would be for someone to take over the project. It'd definitely need to be someone who can commit the time to its development, and develop in line with the way in which the module has been built so far (there's a decent amount of SoC going on, and the module is built up using packages such as Eloquent, FastRoute, etc.). Alternatively, as a third option, we could take a multi-contributor approach. So, if anyone is interested, feel free to send me a DM and we can chat about it.

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites
On 1/22/2019 at 5:38 PM, Mike Rockett said:

Don't have a chance to look into this right now, but is anyone having issues on PHP 7.3? Saw a comment on the module listing from Alex Capes about it breaking. In the meantime, I've opened up an issue over at GitLab: https://gitlab.com/rockettpw/seo/jumplinks-one/issues/1

Running PHP 7.3.1 with the latest version of Jumplinks return a blank page for me.

PHP 7.2.14 seems to work fine.

Share this post


Link to post
Share on other sites

@Mike RockettThank you for the advice... we've tried that but we are not having any luck.  Moreover, we've noticed now that all our redirects are failing and will either error out or get stuck in a loop.  We are getting this error for users not logged in with Tracy: Warning: preg_replace_callback(): Compilation failed: invalid range in character class at offset 6 in   /var/www/html/site/assets/cache/FileCompiler/site/modules/ProcessJumplinks/ProcessJumplinks.module.php

I'm thinking this may have something to do with PHP 7.3.x.  We are running both 7.3.1 and 7.3.2 on our dev and production machines.  Any advice for a workaround?

Thank you.

Share this post


Link to post
Share on other sites

Did you try to delete everything in site/assets/cache/FileCompiler/site/modules/ProcessJumplinks/ ?

And maybe also go to modules > clear compiled files (button at the bottom).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Rudy
      Hi,
      I am writing a custom module that requires storing array of settings in the module config/settings.
      Is there a built-in fieldtype that allows me to store settings in an array (sort of like Repeater)?
      I tried using InputfieldAceExtended and InputfieldTextarea to store JSON array. Both times, my data was stored in the module settings (in the database) but upon reload, that information was not retrieved.
      Thanks
      Rudy
       
    • By Anssi
      A simple module to enable easy navigation between the public and the admin side of the site. After installation a green bar will appear to the upper side of the screen, containing a few navigation elements and displaying the PW version number.
      Heavily inspired by @apeisa's great AdminBar (Thanks!). I needed a bit simpler tool for my projects and as a result, this was made. Available on GitHub .

    • By Sebi
      I've created a small module which lets you define a timestamp after which a page should be accessible. In addition you can define a timestamp when the release should end and the page should not be accessable any more.
      Github: https://github.com/Sebiworld/PageAccessReleasetime
      Usage
      PageAccessReleasetime can be installed like every other module in ProcessWire. Check the following guide for detailed information: How-To Install or Uninstall Modules
      After that, you will find checkboxes for activating the releasetime-fields at the settings-tab of each page. You don't need to add the fields to your templates manually.
      Check e.g. the checkbox "Activate Releasetime from?" and fill in a date in the future. The page will not be accessable for your users until the given date is reached.
      If you have $config->pagefileSecure = true, the module will protect files of unreleased pages as well.
      How it works
      This module hooks into Page::viewable to prevent users to access unreleased pages:
      public function hookPageViewable($event) { $page = $event->object; $viewable = $event->return; if($viewable){ // If the page would be viewable, additionally check Releasetime and User-Permission $viewable = $this->canUserSee($page); } $event->return = $viewable; } To prevent access to the files of unreleased pages, we hook into Page::isPublic and ProcessPageView::sendFile.
      public function hookPageIsPublic($e) { $page = $e->object; if($e->return && $this->isReleaseTimeSet($page)) { $e->return = false; } } The site/assets/files/ directory of pages, which isPublic() returns false, will get a '-' as prefix. This indicates ProcessWire (with activated $config->pagefileSecure) to check the file's permissions via PHP before delivering it to the client.
      The check wether a not-public file should be accessable happens in ProcessPageView::sendFile. We throw an 404 Exception if the current user must not see the file.
      public function hookProcessPageViewSendFile($e) { $page = $e->arguments[0]; if(!$this->canUserSee($page)) { throw new Wire404Exception('File not found'); } } Additionally we hook into ProcessPageEdit::buildForm to add the PageAccessReleasetime fields to each page and move them to the settings tab.
      Limitations
      In the current version, releasetime-protected pages will appear in wire('pages')->find() queries. If you want to display a list of pages, where pages could be releasetime-protected, you should double-check with $page->viewable() wether the page can be accessed. $page->viewable() returns false, if the page is not released yet.
      If you have an idea how unreleased pages can be filtered out of ProcessWire selector queries, feel free to write an issue, comment or make a pull request!
    • By David Karich
      Thanks to the great Pro module "RepeaterMatrix" I have the possibility to create complex repeater items. With it I have created a quite powerful page builder. Many different content modules, with many more possible design options. The RepeaterMatrix module supports the cloning of items, but only within the same page. Now I often have the case that very design-intensive pages and items are created. If you want to use this module on a different page (e.g. in the same design), you have to rebuild each item manually every time.
      With this proof of concept I have created a module which adds the feature to copy a repeater item to the clipboard so that you can paste this item to another page with the same repeater field. The module has been developed very rudimentarily so far. It is currently not possible to copy nested items. There is also no check of Min/Max. You can also only copy items that have the same field on different pages. And surely you can solve all this more elegantly with AJAX. But personally I lack the deeper understanding of the repeaters. Also missing on the Javascript side are event triggers for the repeaters, which would make it easier. Like e.g. RepeaterItemInitReady or similar.
      it would be great if @ryan would implement this functionality in the core of RepeaterMatrix. I think he has better ways to implement this. Or what do you think, Ryan?
      Everybody is welcome to work on this module and improve it, if it should not be integrated into the matrix core. Therefore I put it for testing and as download on GitHub: https://github.com/FlipZoomMedia/InputfieldRepeaterMatrixDublicate
      You can best see the functionality in the screencast: 
       
    • By anderson
      Hi,
      Please take a look at this:
      https://templatemag.com/demo/Good/
      The upper nav bar, including dropdowns like "pages" and "portfolios", what do you call this whole thing? At first I guess it's called "dropdown nav bar", but seems not.
      AND of course, what's the simplest way/module to achieve this in PW?
      Thanks in advance.