Rewrite custom post type URL in search

I have a website in which I have a custom post type (guest authors from CoAuthors Plus). With a plugin I managed to make post of custom type "guest author" searchable by WordPress legacy search.

Now, the authors are correctly shown in search results. Although, they are linked to a wrong page, /?post_type=guest-author&p=2148, which brings to a 404.

I’d like to be able to get the URL, interprete it, and redirect to the correct page (which is in the form of /archives/author/name-surname/.

I’m trying to get it working with a rewrite URL, but I’m not able to catch the data and formulate the rewrite.

Rewrite Module in Linux with .htacess

using pi 3 for the apache server but I can’t figure out how to setup .htacess as previously I use IIS which is totally easy to complete SEO-friendly tag.

But Linux HTAACESS is very much different I still can’t able to figure it out.

First I create .htaccess on the root folder which

RewriteRule ^post/article\.php$      {C:1}/{C:2}/{C:3}/{C:4} RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$      post/article.php?a=$  1&b=$  2&c=$  3&id=$  4 RewriteRule ^sitemap\.xml?$      sitemap.php 

Which Basiclly make,b=,c=,id= show them as like thatbut it never happen.

Then I try in Virtual Directory

Did I have to change the configuration on the virtual directory?

<VirtualHost *:80>     Documentroot /------     ServerName     ServerAlias RewriteEngine On RewriteRule ^post/article\.php$      {C:1}/{C:2}/{C:3}/{C:4} RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$      post/article.php?a=$  1&b=$  2&c=$  3&id=$  4 RewriteRule ^sitemap\.xml?$      sitemap.php </VirtualHost> 

Is anyone able to suggest how can I put rewrite so it actually works? I am very thankful to him.

I also follow guide How to enable use of .htaccess in Apache on Ubuntu? but not work maybe i should my question there.

Is my Wild Magic rewrite balanced?

I despise the Player’s Handbook version of the Wild Magic sorcerous origin—I think it’s poor, lazy design that causes entirely unnecessary strife at the table. There are ways to capture the feeling of chaos and “wild magic” without resorting to shoving an extra responsibility in the DM’s lap. I think Wizards of the Coast can do better—because they have in the past. And taking cues from those better-designed examples, I think I can do better too. But I don’t know D&D 5e as well, so I need help making sure I’ve got the balance right, and I’d also appreciate knowing if any of my verbiage or formatting betrays my stronger familiarity with D&D 3.5e and Pathfinder.

So this is my take on the Wild Magic sorcerous origin. I’ve written it up in what is meant to be the “official” style, and stylistic/formatting/wording critiques are welcome if I’ve missed the mark on that. And anything found to be confusing or ambiguous definitely needs sorting out. But the larger question, of course, is whether the result is balanced and playable. Balancing should be in line with other sorcerous origins, ideally among the better of them (from my understanding, Divine Soul, Draconic, and Shadow are seen as better than Storm or the original Wild Magic).

Sorcerous Origin

At 1st level, a sorcerer gains the Sorcerous Origin feature. The following wild magic option is available to a sorcerer, instead of the wild magic origin offered in the Player’s Handbook.

Wild Magic

None can tell where your magic comes from; it is fickle, inconstant, and unique. Some might associate it with the forces of chaos, whether Limbo or demons or the fey, or those places in the multiverse where reality is frayed and all magic takes on some of the volatility that yours exhibits everywhere. But none of these is a perfect match; there is no perfect match to be found anywhere else—your magic is yours.

Wild Magic Surge

Starting when you choose this origin at 1st level, whenever you cast a sorcerer spell of 1st-level or higher, its casting time is increased by 1 round. Sorcerer spells ordinarily cast as a bonus action or reaction are not affected.

After each short rest, choose a number of different sorcerer cantrips and/or spells you know equal to 3 + your proficiency bonus. These spells are your “Deck.” You can begin a Wild Magic Surge on any of your turns to randomly draw a number of spells from your Deck equal to your proficiency bonus. Drawn spells form your “Hand.” You may “Play” a spell from your Hand in order to cast it without extending the casting time (it still consumes its usual spell slot). Once Played, a spell is no longer in your Hand and cannot be Played again for the rest of the Wild Magic Surge. On each of your turns after beginning a Wild Magic Surge, you draw one more spell at random from the Deck. If there are no spells left in the Deck at the start of your turn, the Wild Magic Surge ends.

At the end of a Wild Magic Surge, roll a d20. If you roll a number lower than the number of spells you drew but did not cast during the Wild Magic Surge, roll on the Wild Magic Surge table to create a random magical effect.

Starting a Wild Magic Surge is not an action, it’s simply something you can do on your turn. Very few conditions can prevent you from starting a Wild Magic Surge: being petrified, unconscious, or dead, being already in a Wild Magic Surge, or having recently been Overdrawn (see below), each prevent you from starting a surge. A charm effect could convince or compel you to choose not to. But you can begin a Wild Magic Surge in any other condition. You do not need any rest between Wild Magic Surges; you can start a new Wild Magic Surge the moment a previous one ends, if you wish (after rolling on the Wild Magic Surge table, if necessary).

This is what makes a Wild Magic sorcerer all about Wild Magic. They have a hard time forcing exactly the spell they want at any given time, but if they go with the flow, they can cast spells without difficulty. Surging like this can draw upon dangerous energies, though the risks remain low.

This design is based on that of the crusader from 3.5e’s Tome of Battle, which used the same kind of deck (readied maneuvers) that you draw (granted maneuvers) and play (initiating them). That design worked phenomenally for the crusader (seriously, one of my favorite classes in D&D history), but there is a distinct difference between maneuvers and spells in this case: the crusader’s maneuvers were almost all about attacking. It didn’t necessarily matter all that much if you drew fancy attack 3 instead of fancy attack 4. Sorcerer spells are a lot more niche and varied, where drawing Protection from Energy when you really need Dispel Magic is a big problem. What I’d kind of like to do is come up with some appropriate cost you could pay (/risk you could take) to allow you to just cast any spell you know. Fitting such a feature in is tricky, though—this feature is already massive. And I’m not quite sure what the cost/risk should be. It would have to be enough that you would generally prefer not to and prefer to go with what you drew.

Anyway, note that this feature is, entirely, downside. That is relevant to the next feature. Also, in case there was any doubt, the Wild Magic Surge table referenced here is the same as the one in the Player’s Handbook version of the Wild Magic sorcerous origin. I don’t love this—that table has serious problems even if it’s not being thrust into the DM’s lap—but as a risk/cost, something to avoid, it might work, plus I gather some people like it and it’s a bunch of work I don’t have to do. I’d consider an alternative cost if anyone’s got any great ideas, though.

Surge of Power

Starting at 1st level, when casting a spell during a Wild Magic Surge, you may choose to play another spell. The second spell is not cast; instead, the first spell is improved. Choose one of the following improvements:

  • You gain a +1 bonus to any spell attacks made as part of the first spell.
  • The saving throw DC of the first spell increases by +1.
  • The duration of the first spell is increased by 1 round for every minute in its original duration.
  • The first spell is treated as if it had been cast from a spell slot one level higher than it actually was. You may only choose this improvement if the second spell was higher level than the first.

And here is why you might consider bothering with the whole Wild Magic thing—that wild magic can power up your spells. Originally I had just gone with +1 spell slot level, as in the last bullet, without requiring that the sacrificed spell be higher level, but it seemed too strong for something you could theoretically do every round. Still, I do want this to be good, because as discussed, Wild Magic Surge is purely downside.

Note that Surge of Power plays a spell without casting it—since it was played, you can’t cast it. That means it will necessarily count against you at the end of the Wild Magic Surge, increasing the risk of random magical side-effects.


Starting at 6th level, when casting a spell during a Wild Magic Surge, you may choose to play another spell. The second spell is not cast; instead, the first spell gains the benefit of any Metamagic ability you know without spending sorcery points. The level of the second spell must meet or exceed twice the regular sorcery point cost of the Metamagic, however.

Sort of obvious (I think?) extension of Surge of Power. Unsure if the ratio of sorcery points to sacrificed spell level is right, but it feels right looking at the sorcery point costs of the the Metamagic effects in Player’s Handbook. (Does any other source include more Metamagic options?)


At 14th level, when you reach the end of your Wild Magic Surge, you may choose to become Overdrawn. If you do, you draw your entire deck (even those spells already played during the wild magic surge) and extend your Wild Magic Surge until the end of your turn. At the end of your Overdrawn turn, you gain a level of exhaustion, and you cannot begin another Wild Magic Surge for 1 minute.

This requires surging for three rounds before you can activate it, which means it’s probably only an option in big boss fights—which is kind of the idea! But if you can’t finish things with this power, you’re also kind of taking yourself out of the fight, since for a whole minute you are stuck with extended casting times.


Beginning at 18th level, if you would die, you can interrupt whatever event is killing you in order to take an immediate extra turn. For the extra turn, you recover any features you ordinarily would with a short rest, you become Overdrawn, and you gain a temporary 9th-level sorcerer spell slot. At the end of this turn, your own magic tears you apart, as if you had been killed by Disintegrate. (Any creature whose action was interrupted does not get the opportunity to choose to do something else with their action as a result of you being disintegrated.)

I love this feature, it seems narratively appropriate, like just the kind of thing you’d expect a Wild Magic sorcerer to do, and the considerable power on offer seems appropriately balanced by the huge and obvious downside—you have to die! Ultimately, though, as much as I love this, I’m not sure it’s such a great idea to dedicate an entire class feature to something you really want to never use. Best case scenario, this becomes a Crowning Moment of Awesome for the end of a campaign, but is it a good idea to have a feature that, in the best case, is only ever used once?

rewrite URL based on selected taxonomy for post page

I have a taxonomy called "group", and their values like "red", "blue", "green" (these are generating dynamic" no any fixed group value.

during post publish I am selecting "Group" for each post. 1 group for each post.

I want to add a rewrite URL for the post if the taxonomy is "red" or "blue" or "green" then the URL of that post should come like

"" or "" or ""

add_action( 'init', 'create_group_tax' ); function create_group_tax() {     register_taxonomy(              'group',              'post',               array( 'label' => 'Group',                      'hierarchical' => true                 )         ); }  add_rewrite_rule('^red/([^/]*)/?','index.php?group=$  matches[1]','top'); 

also, I want to make it regex rule "'^red/([^/]*)/?'" dynamic with selected taxonomy,this time just to make a test i added it as a static string.

result : Page not found. Nothing here – http://localhost/wordpress/red/my-test/

what do you suggest to do this?

Default Post post type and custom post type rewrite slugs

So, currently, my blog page is at /blog/ and I also have 2 custom post types. What I’m trying to get is to have all the posts/archives of the Post post type show under /blog/, and for one of the custom post type to use "/" as a rewrite slug. That way, I could get,, which are the custom post types, and if I go to post archive for December of 2020, it would show under /blog/2020/12/.

I’ve tried that, as I said, by setting /blog/%postname%/ under my wp admin permalink settings, and using 'rewrite' => array( 'slug' => '/', 'with_front' => false ), with register_post_type for my custom post type. That works for blog posts, but my custom post type posts show 404, with proper url though.

Rewrite a folder name using .htaccess don’t want to work

I am wondering, why folder renaming doesn’t work. RewriteRule ^pl/(.*) public/$ 1

Lets say I have a url like: 

Now I want to rewrite the url to 

"pl" is not a folder rather just a name!

The rest works fine. Why just that one rule doesn’t work?

my .htaccess

RewriteEngine on RewriteRule ^dekoracyjne.html$   decorative.php [NC,L] RewriteRule ^pl/(.*) public/$  1 RewriteRule ^dekoracyjne/(.*) decorative/$  1 RewriteRule ^techniczne.html$   architectural.php [NC,L] RewriteRule ^techniczne/(.*) architectural/$  1 RewriteRule ^show.html/([-\w]+)$   show.php?id=$  {products:$  1} [L] RewriteRule ^p.html$   product_configurator.php [NC,L] RewriteRule ^show_c\.html/([-*\w]+)$   show_c.php?cat=$  {catcolors:$  1} [L] RewriteRule ^(product_configurator)\.html/(\d+)&([-\w]+)$   $  1.php?prometheus_id=$  2&id=$  {products:$  3} [L] RewriteRule ^(ss_c)\.html/(\d+)&([-\w]+)$   $  1.php?prometheus_id=$  2&id=$  {products:$  3} [L] # Rewrite other ".html" requests to ".php" RewriteRule (.+)\.html$   $  1.php [L] 

Rewrite existing procedure without merge as Oracle 12.1 doesn’t support it

I have a procedure where data is pushed into table using merge logic used as part of it. The procedure takes string passed at runtime and splits it into rows.

I need to change the merge part using any other method other than merge, maybe cursor for loop as Oracle 12.1 does not support merge and similar take input string and insert/update accordingly in the destination table. inside procedure and we cannot get it upgraded due to constraints.

So everything in proc would be same just that it would be without merge.

The details are inside the fiddle with table and sample data.

Rewrite rule for changing permalinks. Post name to permalink with Category


  1. I have an wordpress site that has existing posts.

  2. Permalink structure is currently configured to

  3. I need to change the Permalink structure to but when I save these settings results to 404 does not redirect to

  4. When I remove the /%category%/ and just use the 301 redirection from works fine

Is there a better way to achieve changing to with proper redirections from

Note: I already deactivate all plugins and just used the default twentytwenty theme. I have 11,000 existing posts.

SCENARIO B (if Scenario A does not work or there is no solution to Scenario A. Im looking at option Scenario B)

  1. The existing posts are under a category called "Local News", "local-news"
  2. Is there a way where I can just filter the rewrite rule so that if a post is under "Local News" category then the permalink structure will be then all other new posts will follow the main permalink structure I have set which is ?

Currently I have this but I’m not sure it’s working properly. When I apply this it seems to work for posts that are under "Local News" category. However it breaks my PAGES. PAGES result in 404s.

function custom_permalink( $  permalink, $  post, $  leavename ) {     // Get the category for the post     $  category = get_the_category($  post->ID);     if (  !empty($  category) && $  category[0]->cat_name == "Local News" ) {         $  cat_name = strtolower($  category[0]->cat_name);         $  permalink = trailingslashit( home_url('/' . $  post->post_name .'/' ) );     }     return $  permalink; }  add_action( 'init', 'custom_rewrite_rules' ); function custom_rewrite_rules() {     add_rewrite_rule(         '([^/]+)(?:/([0-9]+))?/?$  ',         'index.php?category_name=local%news&name=$  matches[1]&page=$  matches[2]',         'top' // The rule position; either 'top' or 'bottom' (default).     ); } 

Is this a correct approach or is my code correct? I’m also not sure if the rewrite rules I made affects other things. Basically I just want to retain permalink/url of the old posts and moving forward I want to follow the new permalink settings. I’m avoiding old posts to result in 404 pages.


Paged/Pagination Not Working on URL Rewrite Rule

add_action('init', 'do_rewrite'); function do_rewrite(){     add_rewrite_rule('^shop/men/?$  ', 'index.php?post_type=product&product_tag=men', 'top');     add_rewrite_rule('^shop/men/page/([0-9]{1,})/?$  ', 'index.php?post_type=product&product_tag=men&paged=$  matches[1]', 'top');     flush_rewrite_rules(); } 

The first rewrite rule works great. goes directly to with the post_type and product_tag filtered as expected.

Now, if I go to

The query and filters in the url, including the new paged of 2, works as intended.

So I assumed my rewrite rule would work the same. But instead it just goes straight to my 404 Page Not Found Error Page.

When I do go to the link with the paged=2 query in the url, it does do a redirect to

So my best guess is that there may be some overlap of some sort causing the issue… but I am not sure where to go from here. How can I get my paginated rewrite rule to work with the url .../shop/men/page/3 and so forth in my add_rewrite_rule?