Cleanup URL for a custom page in wordpress

You can do this with the internal rewrite system, which is parsed in php, not htaccess. First, add the rule. This assumes you have created a root page under Pages with the slug dictionary. function wpd_dictionary_rewrite(){ add_rewrite_tag( ‘%dictionary_word%’, ‘([^/]+)’ ); add_rewrite_rule( ‘^dictionary/([^/]+)/?$’, ‘index.php?pagename=dictionary&dictionary_word=$matches[1]’, ‘top’ ); } add_action( ‘init’, ‘wpd_dictionary_rewrite’ ); This code would go in … Read more

Rewrite rule to load images from production does nothing

RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . index.php [L] # If images not found on development site, load from production RewriteCond %{REQUEST_URI} ^/wp-content/uploads/[^\/]*/.*$ RewriteRule ^(.*)$ https://www.example.com/$1 [QSA,L] The problem here is that “If images not found on development site” then the request has already been rewritten to index.php by the preceding RewriteRule (WordPress front-controller), … Read more

Rewrite URL for only archive page (custom post type)

You can have a separate slug for the post type archive by setting the slug as the value for the has_archive argument, instead of just true: register_post_type( ‘event’, array( ‘has_archive’ => ‘agenda’, // etc. ) ); Now you can use single-event.php and archive-event.php for the single and archive views, but the URL for the archive … Read more