WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Adding custom mod_rewrite rules (3 posts)

  1. Rebecca Schaefer
    Member
    Posted 5 years ago #

    I'm writing a plugin, and looking for a way to add custom mod_rewrite rules.

    Currently, I'm loading a copy of an archive file. Then there are various $_GET variables. So if my file is ?page_id=12&var1=11&var2=10&var3=9 I want to display /page/var1/var2/var3

    Since these vars aren't in the taxonomy, I'm getting booted to a 404 page.

    I'm looking for a way to add my own rules to the rewrite.php file (or whichever file will work best).

    Any suggestions?

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    This page covers some of the basics of the WP_Rewrite functionality:
    http://codex.wordpress.org/User:DavidHouse/WP_Rewrite_API

    You'd add this sort of code to a plugin or a theme's functions.php file.

    In your case, you probably want to look closely at add_rewrite_tag and add_rewrite_rule.

  3. Rebecca Schaefer
    Member
    Posted 5 years ago #

    You totally rock! =)

    I'm not sure if this will do what I need, but it should be enough to get my husband to figure out how to make it work!

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic