Virtual Page with Registration form
Make sure you flush the rewrite rules WPAdmin->Settings->Permalink->Save. Sometimes only flushing fix the 404 errors.
Make sure you flush the rewrite rules WPAdmin->Settings->Permalink->Save. Sometimes only flushing fix the 404 errors.
Go to Settings->Permalinks Add this to Custom Structure: /%postname%/ Update WordPress generates .htaccess-files for this. Just go to your root and activate the show invisable files on your computer. Here is the htaccess for the structure: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d … Read more
Create an endpoint. In the callback function for the endpoint call your plugin functions internally, so the whole WordPress environment is available and you are still on the same domain, no matter where the plugin URL is. Plus, make sure not to flush the rewrite rules on every page load, use the (de)activation hook for … Read more
Sounds like you are doing it right. If you will add a rule per entry you will slow down the whole URL parsing, especially for pages. About the 404. If you are actually redirecting, then it means that you don’t send a 404 as there can be only one return code.
I’m affraid this “nasty” solution would be the most effective than trying to write some cool function that will translate your permalinks into pretty permalinks: $permalink = rtrim( get_permalink( $id ), “https://wordpress.stackexchange.com/” ) . ‘/foo’ . ‘/2’; The rtrim part (removing trailing slash) is just for to be sure there are not going to be … Read more
You can try this: function my_car_rewrite_rules( $rules ) { $newrules = array(); // add a rule for this kind of url: // http://myhost.com/cars/ferrari/used/123 // => http://myhost.com/index.php?post_type=cars&ferrari=used&p=123 $newrules[‘^cars/([^/]+)/([^/]+)/([^/]+)$’] = ‘index.php?post_type=cars&$matches[1]=$matches[2]&p=$matches[3]’; return $newrules + $rules; } add_filter(‘rewrite_rules_array’,’my_car_rewrite_rules’); and remember to “save the permalinks” when testing. I added /cars/ so this rewrite will not overwrite your other pages. … Read more
You could add the path via add_rewrite_endpoint, then alter the query via the pre_get_posts action. Here’s a proof-of-concept example that alters the posts_per_page when domain.com/highest-rated/ is requested: // add the endpoint function wpa85664_add_endpoint(){ add_rewrite_endpoint( ‘highest-rated’, EP_ALL ); } add_action( ‘init’, ‘wpa85664_add_endpoint’ ); // check if the endpoint is in the current request // and alter … Read more
I finally got my rewrite rules to work here: $home = get_post(Sunshine::$options[‘page’]); // Gallery add_rewrite_rule($home->post_name.”/gallery/([^/]+)/page/?([0-9]{1,})/?$”,’index.php?pagename=”.$home->post_name.”&sunshine_gallery=$matches[1]&paged=$matches[2]’,’top’); add_rewrite_rule($home->post_name.”/gallery/([^/]+)/?$”,’index.php?p=’.$home->post_name.’&sunshine_gallery=$matches[1]’,’top’); add_rewrite_rule($home->post_name.”/gallery/([^/]+)/?$”,’index.php?pagename=”.$home->post_name.”&sunshine_gallery=$matches[1]’,’top’); // Image add_rewrite_rule($home->post_name.”/image/([^/]+)/?$”,’index.php?pagename=”.$home->post_name.”&sunshine_image=$matches[1]’,’top’);
This works: mysite.com/sermon/term/childterm/page2/ This does not: mysite.com/sermon/term/childterm/page2/ according to your rewrite rule, I guess what you mean is This works: mysite.com/sermon/term/page2/ This does not: mysite.com/sermon/term/childterm/page2/ I’m not a regex expert so I only come up with adding another rewrite rule to handle the childterm situaion add_rewrite_rule( ‘sermon/(.*?)/(.*?)/page/?([0-9]{1,})/?$’, ‘index.php?post_type=”.$cpt.”&’.$tax.’=$matches[2]&paged=$matches[3]’, ‘top’ );
If you want to have domain.tld/PAGE-NAME.php then you could just use %postname%.php as custom structure. // Edit As this approach seems to work for posts only, you might have a try with the structure /%postname%/. In addition, you put the following lines to your .htaccess: <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^(.*).php /$1/ [R=301,L] </IfModule> // … Read more