Pretty Links with custom wordpress application (2 posts)

  1. Flare576
    Posted 3 years ago #

    Greetings again!

    Right off the bat, I should probably say I do not know enough about WordPress; I'm probably making a rookie mistake and just don't know it. Here's the situation:
    - I built a tool that uses WordPress for Theme and user management, but otherwise doesn't use WordPress features (see my first question)
    - I bundled the tool up as a WordPress Plugin and "Installed" it on our server.
    - All of our links to the tool look like this:


    and we'd love for them to be


    The problem is.... Nothing I do with the rewrite rules seems to work. I've attempted to replicate the example here for the first rule (main index) as:

    add_filter( 'rewrite_rules_array','fcn_rewrite' );
    function fcn_rewrite($rules){
    	$newrules = array();
    	$newrules['library/'] = 'wp-content/plugins/cardchooser/';
    	return $newrules + $rules;

    and then calling flush_rewrite_rules(false); in my plugin activation. I AM seeing the rule get written to the DB, but when I go to


    All I get is a 404. I THINK it should be replacing "library/" with "wp-content/plugins/cardchooser/", but apparently I'm not entirely understanding.

    Any guidance? I think once I solve the mystery of this, I'll be able to implement the rest of the rules easily:

    $newrules['library/card/(\d+)']= 'wp-content/plugins/cardchooser/createCard.php?c=$matches[1]';
    $newrules['library/art/(\d+)']= 'wp-content/plugins/cardchooser/createArt.php?c=$matches[1]';
    $newrules['library/art/']= 'wp-content/plugins/cardchooser/index_art.php';
    $newrules['library/']= 'wp-content/plugins/cardchooser/index.php';

    Thank you all for any help!

  2. Flare576
    Posted 3 years ago #

    I couldn't figure it out in WordPress, but since I'd done everything else with this tool NOT using WP, I figured why should this be any different:

    .htacess file now contains

    RewriteRule ^library/card/(\d+) wp-content/plugins/cardchooser/createCard.php?c=$1 [QSA,L]
    RewriteRule ^library/artifact/(\d+) wp-content/plugins/cardchooser/createArtifact.php?c=$1 [QSA,L]
    RewriteRule ^library/spec/(\d+) wp-content/plugins/cardchooser/createSpec.php?c=$1 [QSA,L]
    RewriteRule ^library/tier/(\d+) wp-content/plugins/cardchooser/createTier.php?c=$1 [QSA,L]
    RewriteRule ^library/art/(\d+) wp-content/plugins/cardchooser/createArt.php?c=$1 [QSA,L]

    (among a few others to make everything work with relative linking), and everything is happy. Disappointed (again) in WordPress's learning curve, but at least my project works :)

Topic Closed

This topic has been closed to new replies.

About this Topic