Try using this:
if (!is_admin()) {
add_rewrite_rule('([A-Za-z0-9])/([A-Za-z0-9])', 'index.php/product?subcategory=$1&product=$2', 'top');
add_rewrite_rule('([A-Za-z0-9])', 'index.php/categories/?cat=$1', 'top');
}
Related Posts:
- Can I write ‘RewriteCond’ using ‘functions.php’?
- Prevent Buddypress Rewrite Rules on Non-Buddypress pages/posts
- Bypass .htaccess when using download_url
- add_rewrite_rule with bottom priority doesn’t handle the WordPress pages
- WordPress Rewrite API calls not creating new rules
- Newbie question: no index.php? in my plain wordpress permalink
- Static variable and add_rewrite_rule?
- Apache Fallback instead of add_rewrite_rule
- Performance impact of rewriting WordPress URLs
- Changes in permalink structure in WordPress and how to apply to in-site links
- WordPress Persistent connection rule does not work for “posts”
- Append query string to all URL’s
- custom rewrite rule help! Custom rewrite rules not applying to custom post type
- custom url rewrite for wordpress
- Loading index.php contents which located outside blog folder for post single page
- Create custom permalinks to show Custom Post Type’s relationship?
- How can I hide that I Use WordPress (with W3 Total Cache)
- Rewrite with pagination /foo/page/2/ to posts of a given category, page 2
- How to override url params with rewrite rules vars?
- Using rules in Posts
- Simple seo-friendly custom $_GET url rewrite with htaccess
- WordPress Rewrite Rule
- How do I add my PHP app to a WordPress page whilst keeping semantic URLs?
- Why is home page content not displaying with this rewrite rule?
- Modifying WP URL handing code?
- Disable category RSS Feeds on WordPress blog with PHP
- Change permalink structure specific category
- Rewrite rule for wp
- Rewrite /keyword1+keyword2.html to search page | .htaccess
- add_rewrite_rule questions
- rewrite_rule – working fine but broken for pagination
- Redirect homepage /page/1/ to /blog/page/1/
- WordPress rewrite question
- WordPress add parameters with friendly url structure
- add_rewrite_rule image from /images/site2/favicon.ico to /favico.ico
- Same Custom Post Type Slug and Custom Taxonomy Slug, with hierarchial unique permalink structure
- Contact form redirecting to page not found on send
- Setting custom cookies in WordPress
- Encode text string being appended as query to URL [closed]
- adding a filter to a shortcode?
- Permanently remove first image from posts
- Change the footer text on the login page
- Rewriting search and pagination base
- Copyright info change in Theme Child PHP
- post meta value as shortcode parameter
- Adding Field to Profile “Name”
- User Defined order on get_categories?
- Is the regular ajax request method safe or I should use admin-ajax.php?
- Does WordPress need the eval function?
- wp_mail not sending
- PHP Date display as time ago
- Pass get_option value to an array [closed]
- how could I load a different template part by page
- Notice : add_theme_support( ‘post-formats’ ) was called incorrectly [closed]
- How to call plugin function per site in a multisite?
- PHP, Creating a dynamic variable
- How to Internationalize WordPress – Extract strings with textdomains, per textdomain individually
- Automatic Shortcode Creation with Custom Fields [closed]
- WordPress function when file is uploaded, deleted or edited
- Using a $GET parameter from a URL, to redirect to a URL (WordPress)
- wp-options keep crashing please help
- Post’s ID pattern?
- Countdown to date function?
- calling a custom field value inside functions.php
- User Meta Value not echoing despite Var_Dump Showing correct string
- WordPress check if current taxonomy has child
- Is there a name for trivial WP PHP files like functions.php, archive php entry.php, page.php and so forth?
- show something only when user comes from specific page at remote host?
- get_theme_mod outputs number when using WP_Customize_Cropped_Image_Control
- array_rand not working correctly?
- How do I increase the upload size only when editing special pages?
- Adding php script to WordPress [closed]
- Function Display article [closed]
- Show login greeting above sub-menu links?
- Conditional On custom field plugin metabox
- Exclude function from running on a certain page
- wordpress sql posts query won’t display the latest post in a specific category
- Woocommerce Custom Meta Boxes- How to only display if they actually have content
- How to change image product page by variation in PHP code?
- duplicate posts with ajax load more wordpress
- Fetch Data from an external MSSQL Database in a Managed WP hosting
- Posts page (category) layout modification, which php file change?
- How to add WordPress Featured image in tag ..?
- Merge wp_get_post_terms
- Php cron job (wp-cron) not working
- Huge time to first byte on live site
- CPT in a shortcode
- All categories options or All categories not Populating
- WordPress load javascript file if something… (after the page is loaded)
- how can I disallow special characters, space, capital letter, dot in user name on registration?
- WordPress Shortcode based on other shortcode
- Force CSV download with template_redirect
- Insert double entry in DB
- Exclude Post ID from Array Specified in Custom Field
- Loading a post’s content, into a div outside the loop, when it’s title is selected in a list
- Adding a Sub Menu Options Page WP Backend Menu. Whats wrong with my code?
- how to add display_name
- advanced custom fields: repeater field within conditional statement [closed]
- How to pass value to add_filter wpcf7_form_tag from another function?
- How can I eliminate the top-level URL slug in WordPress while still being able to access child pages, particularly three levels deep or more?