Leave your activation function as it is, and create another for the rewrite rules hook:
function wpse_209303_rewrite_rules( $wp_rewrite ) {
$wp_rewrite->add_external_rule( '(.+)\.([0-9\.\-\_]+)\.(js|css)$' , '$1.$3');
}
add_action( 'generate_rewrite_rules', 'wpse_209303_rewrite_rules' );
Related Posts:
- Is it possible to use multiple post_name, post_title and post_content?
- rewrite_rules() not applying rules on plugin activation only after permalinks menu is clicked
- Rewrite/Change custom taxonomy slug
- How to disable wordpress page rewrite rule?
- How to programatically create a simple HTML page using the permalink of a WordPress post?
- Custom pages with plugin
- How to call a plugin function from index.php
- Rewriting every url
- Add Rewrite Rule for custom page
- How Do I add a redirect rule to WordPress?
- add_rewrite_rule, plugin activation and plugin deactivation
- Change post permalink to external URL from custom field
- flush_rewrite_rules not working on plugin deactivation, invalid URLs not showing 404
- Prevent page slug from interfering with custom post type archive permalink?
- Passing URL parameters to WordPress pages and pretty url
- Custom rewrite rule is not picked by WordPress
- Change Permalinks Structure to a Sequential Number for Each Post?
- Publish Post After Click On A Link
- flush rewrite rules doesn’t flush them (still got 404)
- How to prefix `attachment` permalinks with `attachment`?
- How to get the custom page get_permalink?
- How to set “with_front’=>false” to a plugin-generated cpt?
- Does flush_rewrite_rules() remove all rules added by other plugins as well as mine?
- Custom url structure for custom template
- How do I customize my WordPress shortlink structure in link-template.php without a plugin?
- Add a Custom Permalink option in the Permalink Admin Screen?
- How can I rewrite a plugin generated URL?
- flush_rewrite_rules() not working on plugin activation
- How to get the permalink of a page when loading my plugin
- Rewrite url without flushing the database?
- Custom page slug without creating a WP page
- Remove rewrite rules generated by plugin during deactivation
- How does WP handle multiple matching rewrite rules?
- How do I add a custom sub menu menu under Woo-commerce marketing?
- Changed permalink structure. Need help with redirecting old posts
- Change permalink structure hidden button edit
- Load custom PHP on a custom URL via a plugin
- How to change custom post type pemalink Hierarcy
- resetting permalinks after changing page names
- Plugin appends ugly URL string to index
- AddToAny shortcode in the loop
- ‘No Results Found’ on single post for custom post type
- Outbound link autometic converted into linkdirect , and not opening
- Custom rewrite rules not working with WPML
- Remove /product/ from url. I want only category name then product name
- Redirecting thousands of posts that currently have no category in their permalink when changing permalink structure to include category
- Customize permalink wordpress category id
- Reoccurring 404 Errors on all subpages
- Problem with Author page redirect
- Perform internal redirect in WordPress?
- Using arbitrary paths in page urls
- “Custom Post Type Permalinks” plugin URL strcuture
- Filtering get_permalink in Jetpack / ShareDaddy
- plugin links not working [closed]
- Redirect to another page using contact form 7? [closed]
- Remove .htaccess portion upon plugin deactivation?
- How to get the permanent link in a plugin?
- Custom url rewriting
- This WordPress plugin isn’t creating links correctly
- flush_rewrite_rules() not working with update_option_{$option}
- Plugin not working & permalink erorr after upgrade to php 7x on Nginx
- Disable plugin If slug contains specific word
- How do I create a custom permalink structure for a page template
- WordPress rewrite rules not working
- I want to filter my products with attributes [closed]
- Do rewrites added with add_rewrite_rule() persist after plugin deletion?
- Passing value as hidden parameter to next page
- Make get_permalink() work outside the Loop using filters
- Permalinks and pagination are not working in WordPress with WP e-Commerce plugin
- can’t install any wp plugins [duplicate]
- Oops! That page can’t be found
- add_rewrite_rule to load different page, without changing URL in browser
- Error in Fetching Custom Post Type parent Category URL (slug)
- Hidden permalink different from displayed permalink
- WordPress Frontend Page using Plugin
- Child theme modifications not showing up
- Create new page in wordpress plugin which doesn’t exist
- one url for all pages
- Getting Fatal error: Uncaught Error: Call to undefined function plugin_dir_path() when linking to another file within my wordpress plugin
- Is it possible to have permalinks to sub-domain pages and to root pages within one single WP instance?
- Change custom rewrite rule when permalink is updated/changed
- Changing author slug for a custom role without using plugin
- Category Arabic Slug shows as symbols in plugin lists
- Members-only page, but accessible via sharable link
- added code to permalink (URL)
- How to setup same post slug for different categories?
- How to add add blank non-editable wp page like default blog for use with plugin
- Is it possible to change plugin’s Admin Panel Url?
- Coming soon pages with rest of site in maintenance mode
- Apache rewrite rules and wordpress problem
- Change post permalink to external URL from custom field
- homepage olderposts link showing page not found
- Rewrite rule help for gallery plugin
- 404 not found problem with URL rewrite custom category
- Adding Category in URL in some post
- WP Job Manger change jobs url (NOT slug)
- Does anyone have the Custom Post Permalinks plugin from John P. Bloch? [closed]
- How to remove site name (https://exp.com/) from WORDPRESS site source links or file load url
- claim a permalink and all sublinks in plugin
- Getting 400 Error in wordpress website