• Resolved americanninja

    (@americanninja)


    This module is great and just what I’m looking for, however it doesn’t work well with my sites previous URLs.

    I’m moving from Drupal to WordPress and after much consideration, I want to just restructure the paths of my site to Drupal standards.

    My previous site has URLs like this:

    sitename.com/jp/japan/shopping/3222/diamond-palace-tokyo

    As it seems WordPress does not support alias paths (slugs) with forward slash out of the box, and even when I enable custom permalinks, I can’t seem to get the content to import through WP All import without removing all the forward slashes, I have just decided to go with the standard wordpress URL formatting of:

    sitename.com/listing/title

    However, when using this plugin, I’m guessing it grabs the first couple of terms and matches Japan and Shopping and then just gives me a random shopping page. However, if I feed my site sitename.com/diamond-palace-tokyo, it will redirect to the correct page.

    Any suggestions what I can do to modify the plugin code or is there a settings box somewhere where I can modify? Perhaps if I limit to only match terms to content titles, it would work. Thoughts?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Thank you for the report. May I ask you an example of how your “Diamond Palace Tokyo” permalink looks like in WordPress?

    Is it: sitename.com/listing/diamond-palace-tokyo? If so, it’s weird because the plugin starts by looking for the last part of the URL.

    So in sitename.com/jp/japan/shopping/3222/diamond-palace-tokyo, it will isolate diamond-palace-tokyo first and look for a similar post/page.

    Also, can you activate the “Debug Console” in your admin page, and while being logged in as admin, try to reach your previous permalink: sitename.com/jp/japan/shopping/3222/diamond-palace-tokyo and paste a screen capture of the debug page here (you can hide domain if necessary).

    Thanks!

    Thread Starter americanninja

    (@americanninja)

    Hi there,

    Thanks for the quick response! Yes, my new wordpress site has the format of:

    sitename.com/listing/diamond-palace.

    (Note that it is not Diamond-Palace-Tokyo, but just diamond-palace. This is because my old Drupal site would append the location of the place onto the URL.

    So basically my old Drupal site has the URL structure which is sitename.com/jp/japan/shopping/3222/diamond-palace-tokyo.

    So I tested a few combinations of the URL with your plugin to see what would happen. Below are the results:

    sitename.com/jp/japan/shopping/3222/diamond-palace-tokyo – redirected to the wrong listing (actually it goes to an attachment page of a photo – not a content page)

    sitename.com/japan/shopping/3222/diamond-palace-tokyo – redirected to the wrong listing (actually it goes to an attachment page of a photo – not a content page)

    sitename.com/shopping/3222/diamond-palace-tokyo – redirected to the wrong listing (actually it goes to an attachment page of a photo – not a content page)

    sitename.com/3222/diamond-palace-tokyo – redirected to the correct listing. yeah!

    sitename.com/diamond-palace-tokyo – redirected to the correct listing. yeah!

    sitename.com/jp/japan/shopping/diamond-palace-tokyo – redirected to a listing for a ramen shop (I simply removed the number, and it redirected me to a listing of a ramen shop).

    I’m guessing the results differ because it’s looking at the other values in the URL and some of them match with one category (which is cities) and another category (which is the listing type – e.g. daily-life). Which is why I thought if I could just edit a setting in your plugin to restrict the matching to let’s say only titles, I think it would have a fairly high accuracy rate. I do think this would add a lot of value to your plugin, if you had checkboxes on the config page, where you could enable or disable matching items (title, tag, category, or date).

    Regarding your request to run in debug mode. I enabled the debug mode and then tried to load my old permalink (sitename.com/jp/japan/shopping/3222/diamond-palace-tokyo.) and it just redirected me to the incorrect attachment page of a castle image. No debug screen or information came up. Behavior was exactly the same as prior to checking the debug mode checkbox and hitting save. I am also logged in as the only user on the site (also the admin).

    I tried again, by just using the shortened incorrect path, such as sitename.com/diamond-palace-tokyo, and then the debug screen displayed.

    Thanks again!

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Okay, first, if the debug screen isn’t displayed when you actually checked it, then it means that WP 404 Auto Redirect to Similar Post isn’t doing the redirection.

    You probably have an another redirection plugin/configuration which takes action before my plugin. My plugin will only do something if a 404 is about to be displayed, like it’s the case for the last test you did with sitename.com/diamond-palace-tokyo.

    I suggest you to try to disable my plugin and see if the wrong redirections still occur.

    In the case you have an another redirection plugin here are the request priority

    • Requesting URL
    • “Redirection” Plugin matching the requested URL => Redirection
    • No “Redirection” Plugin matching? => 404 Not Found
    • Before the 404 get triggered => WP 404 Auto Redirect takes effect

    Can you check your plugins list and let me know?

    Thread Starter americanninja

    (@americanninja)

    So this behavior is very bizarre. I don’t have any other redirect plugins enabled on my site except yours.

    For most URL links it will give me your debug screen when I try to access the link. And when I disable your plugin, it will give me a 404 page.

    But here is the strange thing. When I attempt to go to the link as I mentioned previously:

    sitename.com/jp/japan/shopping/3222/diamond-palace-tokyo

    it forwards to an image attachment page (ex. sitename.com/listing/the-westin-nagoya-castle/attachment/castle2/)

    However, if I remove the 3222 from the URL (ex. sitename.com/jp/japan/shopping/3222/diamond-palace-tokyo) it will give me a 404 page when your plugin is disabled, and it when it’s enabled, it will display your debug page.

    So it seems it has something to do with having a random number listed within the path.

    Any ideas?

    Is there a way you can PM me? I can provide you with the URL of both my old site and new site so you can see. I would just like to not list it here on the public forum. Sorry for being a pain. Thanks!

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    No problem mate, it’s always interesting to understand & debug stuffs ??

    In my opinion there’s a plugin/theme function or something which interefere with your permalinks/redirections.

    A kinda simple resolution could be:

    Install Redirection plugin which let you configure dynamic redirection matching pattern with regex. With that plugin redirect all links which match /jp/japan/shopping/3222/diamond-palace-tokyo to redirect to: /diamond-palace-tokyo. So my plugin can take action.

    In any case you must understand what’s going on, because it’s important to understand how your website behave with each one of its plugin (if you want to tweak it correctly).

    Please, send me an email from https://hwk.fr/ (in the footer), I’ll try to help you ??

    Thread Starter americanninja

    (@americanninja)

    Thank you! I will try the redirect recommendation you just posted. Also, I have sent you an email through your contact form in the footer. Thanks!

    Thread Starter americanninja

    (@americanninja)

    Well, I couldn’t figure out why the random redirect was happening, as I checked all the enabled plugins and none of them are redirection plugins nor should they be doing the redirection.

    Anyway, in the end, I just decided to take all my old Drupal listings and through them in a spreadsheet and match up with the new paths in wordpress and import them using the Redirection plugin.

    But I think I will keep yours enabled for catching any random traffic where people may be looking for some content that no longer exists, but similar content does.

    Thanks!

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Sorry for the late answer, I was kinda busy lately. I really suspect a third-party plugin/theme function to hijack the redirection from WP 404 Auto Redirect to Similar Post.

    If you enable the debug console, log-in as an administrator, then try to reach a 404 URL, the debug Console should be displayed. If that’s not the case, then there’s an another code which redirect the URL before my plugin.

    I think you took the good decision regarding your ex-Drupal permalink structure tho!

    Glad your resolved your problem.

    Regards.

    Thread Starter americanninja

    (@americanninja)

    Yes, it is very bizarre. I only have the default plugins provided by WordPress and the main plugins loaded by the theme I installed (ListingPro). I spoke to their support team, and they said that their plugin should not touch anything to do with redirection. So I have no idea what is redirecting outside of this plugin. Anyway, most of the concern has been resolved by importing in the old Drupal permalinks. Thanks again for your always helpful and detailed replies.

    Have a great day!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Is it possible to limit matching only to title or to specify token placement’ is closed to new replies.