Hey Otto,<div>Thank you very much! I'll update the document to reflect that. Like I mentioned before, it's odd how obscure information on adding .htaccess content indirectly is and that's why I took a few hours to write that.</div>
<div><br></div><div>I really appreciate your help and everything else you've contributed to the WordPress community. I've come across at least a handful of your tutorials that have been priceless in helping me learn how to develop themes and plugins *correctly* for WordPress. That takes a lot of time to do that and I appreciate it.</div>
<div><br><br><div class="gmail_quote">On Wed, Aug 31, 2011 at 12:09 PM, Otto <span dir="ltr"><<a href="mailto:otto@ottodestruct.com">otto@ottodestruct.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
BTW, you did get very close to this there at the end. What you missed<br>
was that the add_rewrite_rule function (not the class function, but<br>
the normal one), makes the resulting call to add_rule in the class.<br>
This then does the index.php based determination, and adds the rule to<br>
the $non_wp_rules there.<br>
<br>
No need for an action on generate_rewrite_rules. That's the hard way<br>
to do it. Put your action on init, then just call the add_rewrite_rule<br>
function normally.<br>
<font color="#888888"><br>
-Otto<br>
</font><div><div></div><div class="h5"><br>
<br>
<br>
On Wed, Aug 31, 2011 at 12:03 PM, Otto <<a href="mailto:otto@ottodestruct.com">otto@ottodestruct.com</a>> wrote:<br>
> You missed a rather simple trick that not many people know about. This<br>
> will add a rule to the .htaccess file when the rules are hard flushed.<br>
><br>
> add_rewrite_rule('myrule', '/newlocation');<br>
><br>
> In WordPress, all "internal" rewrite rules must start with "index.php"<br>
> for them to work properly. Any rule that doesn't start with index.php<br>
> gets shoved out into the .htaccess file as a normal RewriteRule when<br>
> the flush happens (basically when you visit the Settings->Permalink<br>
> page).<br>
><br>
> So you can use normal add_rewrite_rule calls to add normal .htaccess<br>
> rules as well as the internal kind.<br>
><br>
> Note: Internal rules use the $matches[1] method for referencing<br>
> pattern matchers. This won't work in .htaccess rules, you have to use<br>
> the $1 method for those rules.<br>
><br>
> -Otto<br>
><br>
><br>
><br>
> On Wed, Aug 31, 2011 at 11:33 AM, David Miles <<a href="mailto:amereservant@gmail.com">amereservant@gmail.com</a>> wrote:<br>
>> Hey everyone,<br>
>> I recently dove into trying to utilize WordPress's rewrite engine and how to<br>
>> add content to the .htaccess file indirectly.<br>
>> I discovered the first part wasn't too complicated once I read over a few<br>
>> tutorials, but modifying/adding to the .htaccess file was a whole different<br>
>> story.<br>
>> So I decided to take a few hours and write some (hopefully helpful)<br>
>> information to help<br>
>> others, <a href="http://codex.wordpress.org/User:Amereservant/Editing_and_Customizing_htaccess_Indirectly" target="_blank">http://codex.wordpress.org/User:Amereservant/Editing_and_Customizing_htaccess_Indirectly</a><br>
>> I'm sure there's things I've missed or perhaps some of you have more<br>
>> advanced knowledge of the topic and can refine the information to be more<br>
>> useful.<br>
>> Either way, I'd love to hear feedback on it and what you think.<br>
>> Thanks,<br>
>><br>
>> David<br>
>> _______________________________________________<br>
>> wp-docs mailing list<br>
>> <a href="mailto:wp-docs@lists.automattic.com">wp-docs@lists.automattic.com</a><br>
>> <a href="http://lists.automattic.com/mailman/listinfo/wp-docs" target="_blank">http://lists.automattic.com/mailman/listinfo/wp-docs</a><br>
>><br>
>><br>
><br>
_______________________________________________<br>
wp-docs mailing list<br>
<a href="mailto:wp-docs@lists.automattic.com">wp-docs@lists.automattic.com</a><br>
<a href="http://lists.automattic.com/mailman/listinfo/wp-docs" target="_blank">http://lists.automattic.com/mailman/listinfo/wp-docs</a><br>
</div></div></blockquote></div><br></div>