Jump to content
apeisa

Release: Redirects

Recommended Posts

Just now, POWERFULHORSE said:

Thanks @adrian. Unfortunately it seems trying to install ProcessRedirects caused some errors and I'm now unable to uninstall it, the module is also interfering with 404s. I'll take a look at jumplinks as soon as I've resolved that.

If you can't uninstall normally, you might need to edit the modules table in the database to remove the line for this module. It might also help to manually delete the module files after making that db modification.

Share this post


Link to post
Share on other sites
3 minutes ago, adrian said:

If you can't uninstall normally, you might need to edit the modules table in the database to remove the line for this module. It might also help to manually delete the module files after making that db modification.

Thanks, I just edited the module's uninstall method as it was referencing a missing table that should have been created during module installation (it was never created as the install method threw errors). Seems to have done the trick.

EDIT: New errors installing jumplinks, wil have a go at attempting to resolve.

  •  Session: Module reported error during install (ProcessJumplinks): SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'created_at'
  •  Modules: Failed to init module: ProcessJumplinks - SQLSTATE[42S02]: Base table or view not found: 1146 Table 'website.process_jumplinks' doesn't exist

Share this post


Link to post
Share on other sites
5 minutes ago, POWERFULHORSE said:

EDIT: New errors installing jumplinks, wil have a go at attempting to resolve.

Maybe take a look over at the jumplinks thread: 

 

Share this post


Link to post
Share on other sites

Questions on this module. I seem to have issues with dynamic parameters in the url.

/test/test?utm=test is catching a 404 and not redirect although this is set-up in the redirect module like:

/test/test -> /newtest/newtest

Share this post


Link to post
Share on other sites

Could anyone help me please? It´s a bit complicated.. 

I have unistalled this module, because of an error with redirect to 404 page (Error Exception table doesn´t exist). Unistallation proceeded with error (error_2). Then I realized it probably did not function because in database, the table name was "processredirect" instead of "ProcessRedirect". Of course, renaming now did not help because of partial uninstallation. Consequently, I deleted table "ProcessRedirect" from database  in order to delete whole module from the system and install it again. However still "Redirects" module was showing among "Site" modules (without "Redirects" in menu however, so I cannot use it), uninstall still did not work. I tried to delete "caches", which ended in losing all info about modules in administration. I imported cache back, however MySQL error "Duplicate entry Modules.wire/modules for key PRIMARY" emerged and modules still did not work. I deleted caches and imported it again with AUTO_INCREMENT option unchecked (default is checked), which worked for modules, however still I am concerned about SQL error "Multiple primary key defined". But it worked, I have info about Modules again. Redirects are still in on-site modules. I tried to find a line with ProcessRedirect in table "modules", but did not find it. I deleted relevant folder in "site/modules", refresh and copied it again, did not work, still Redirects are in "Site" modules. I deleted manually every data about this module from "caches" table, including line ModulesVerbose.info, Modules.site/modules and Modules.info. Did not help. Redirects are still showing among "Site" modules, if the folder is present, even when I deleted them from database. When the folder is not present, they are not showing at all, but I want to install the module again and I can´t because it never shows up among modules which can be installed. I even tried to upload module instead of copying it directly, but I land on the "New modules" tab again and ProcessRedirect is not here to be installed. There is notification "Session: Detected 1 new module: ProcessRedirects" showing, however only text "no modules found" is actually there. Cache module is not installed, PW installation is 2.7.2., I don´t know what else is relevant... 

Thank you very much for any help!

error_2.jpg

Share this post


Link to post
Share on other sites

I had some problems with the database. E.g. the one @esper mentioned. So I deleted the table manually and uninstall the module, because it breaks the frontend when you accessing non-existing page. The error was something with myslqi and the message was 

Couldn't fetch ProcessWire\Database

I'm using PW 3.0.70, i'm not sure if it was working on PW 2.6

Share this post


Link to post
Share on other sites
11 minutes ago, kixe said:

The module doesn't seem to be supported any more (no commits since 4 years, unfixed issues).

I forked the module and switched from mysqli to PDO. I also fixed 2 uninstall bugs.
https://github.com/kixe/ProcessRedirects/tree/kixe

 

 

Hey @kixe - curious if there is a reason you chose to fix this rather than switch to jumplinks? http://modules.processwire.com/modules/process-jumplinks/

Is there something you prefer about this module, or just that you didn't know about the new one?

  • Like 1

Share this post


Link to post
Share on other sites

@adrian

I know Jumplinks. I use it, I like it and I recommend it.

Somebody else using my Process404Logger module had problems interacting with ProcessRedirects. To test and fix this I needed to fix the bugs of ProcessRedirects first. :rolleyes:

  • Like 2

Share this post


Link to post
Share on other sites

I get the following error when installing in 3.0.96

Unable to install module (ProcessRedirects): Specified key was too long; max key length is 1000 bytes

Share this post


Link to post
Share on other sites
2 hours ago, Macrura said:

@neosin pls use jumplinks

or see @kixe‘s fork above

ty

Does this module allow you to redirect content from one post to another?

I have pages that must remain published but redirect users to other pages, I am not sure what the best approach is for this with PW or if there is a module already that can accomplish this.

Share this post


Link to post
Share on other sites
On 20/03/2018 at 3:40 AM, neosin said:

Does this module allow you to redirect content from one post to another?

I have pages that must remain published but redirect users to other pages, I am not sure what the best approach is for this with PW or if there is a module already that can accomplish this.

Jumplinks doesn't allow that, I'm afraid. It hooks onto the 404 event, so it will only respond to requests that don't resolve. You would need to call $session->redirect() in your template to do a redirect from an existing, published page. If you don't mind my asking, why do you need published pages that redirect to others?

Share this post


Link to post
Share on other sites
8 hours ago, Mike Rockett said:

 If you don't mind my asking, why do you need published pages that redirect to others?

@Mike Rockett

i have an events content type and the event pages expire and unpublish after the date has passed however events that are flagged as special can remain active (the url) because it will have been promoted across various media outlets. These expired special event urls will redirect to a related published content item. The related content items do not exist before or during the events. The related items are added by an editor shortly after the event has finished.  Then 6 months later an editor comes back and unpublishes whichever special events they need to remove.

perhaps with PW there is a better approach? I am new to PW please go easy on me ;)

 

Share this post


Link to post
Share on other sites

Hello @apeisa,

thank you for this module. I use it on many sites.

Now I have a client site where the homepage in the default language has a url segment 'de'.

In the LanguageSupportPageNames module I have the setting active to redirect the default language pages to that url segment.

So the homepage URL in the default language reads 'mydomain.de/de/'.

In my opinion this setup does not make a lot of sense but the client insisted, so what can I do....

Now when I add a redirect like '/wer-wir-sind' (which is an old URL from the pre-PW site), the module does not kick in because the LanguageSupportPageNames module adds the 'de' to the URL. Now I end up with a URL like ''mydomain.de/de/wer-wir-sind'. The redirects module cannot find that URL and won't redirect.

As a workaround, the administrator could enter redirects for the default language in the format '/de/wer-wir-sind'. Now redirects work but from a logical point of view this doesn't make sense. Because we want to redirect from' mydomain.de/wer-wir-sind' to a chosen URL and not from 'mydomain.de/de/wer-wir-sind'.

To make a long story short: I added some code to the checkRedirects method of the module right after line 247, which caters for this special use case:

		// if homepage in default language has a language segment and the root URL is redirecting to that language segment,
		// remove the segment from the url so it can be found in the DB
		if(
			$this->wire('modules')->isInstalled('LanguageSupportPageNames') && 
			$this->wire('modules')->getModule('LanguageSupportPageNames')->useHomeSegment &&
			$this->wire('user')->get('language')->isDefault()
		) {
			$homeSegment = '/' . $this->wire('pages')->get(1)->name;
			if (substr($url, 0, strlen($homeSegment)) == $homeSegment) {
                // remove the language segment from $url so it can be found in the DB
			    $url = substr($url, strlen($homeSegment));
			} 
		}

If you think it should be implemented into your module, let me know and I'll make a PR on github.

Cheers

Share this post


Link to post
Share on other sites

I have myself moved to use jumplinks module in our projects. This module is not actively maintained, but for some projects this simplicity just works. 

Feel free to send pr, I might merge it (not sure if that has any unnecessary side effects?) but at least it is there if someone else has same need. 

Share this post


Link to post
Share on other sites

Hi. I'm wondering if there is a way to add code to the module to strip the "?fbclid=" parameter from incoming links. My users have noticed that the redirect links they have established via the module are failing when used from Facebook, due to the new FB click tracking code.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...