I suppose you’ve forgotten the QSA directive, to add properly the query string:
RewriteEngine On
RewriteBase /
RewriteRule ^(\w+)/$ /index.php?state=$1 [QSA,L]
RewriteRule ^index\.php$ - [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [QSA,L]
Tell me if it works, and if not, I’ll do my best to answer.
Two hints:
Please try to use the RewriteLog directive: it helps you to track down such problems:
# Trace:
# (!) file gets big quickly, remove in prod environments:
RewriteLog "/web/logs/mywebsite.rewrite.log"
RewriteLogLevel 9
RewriteEngine On
My favorite tool to check for regexp:
http://www.quanetic.com/Regex (don’t forget to choose ereg(POSIX) instead of preg(PCRE)!)
Related Posts:
- Modifying WP URL handing code?
- How can I modify the permalink via a filter?
- Bypass .htaccess when using download_url
- Can I write ‘RewriteCond’ using ‘functions.php’?
- Newbie question: no index.php? in my plain wordpress permalink
- Change links automatically to affiliate links
- Rewrite sub folder dynamically with country code in WordPress using PHP
- Use WordPress’ URL rewrite engine
- Rename “Portfolio” slug?
- How to rewrite URL with PHP variables with htaccess to a normal looking URL?
- Static variable and add_rewrite_rule?
- Nesting if statements to echo only one string based on what tag was filtered?
- How to change home or site url using action hooks or filter?
- Why do WordPress rewriites seem to work differently for posts vs pages?
- Performance impact of rewriting WordPress URLs
- Is sanitize_title_with_dashes formatting function too liberal (in terms of accepted characters)?
- 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
- subdirectory index.php is not working
- Use URL Rewrite as well as $_GET parameters in URL?
- How to modify URL (add GET values) after front end form submission?
- parts of url disappear when using # inside href=”” [closed]
- Loading index.php contents which located outside blog folder for post single page
- Create custom permalinks to show Custom Post Type’s relationship?
- Add .htm extention to a custom taxonomy
- Help with .htaccess and Login with Subfolders
- How can I hide that I Use WordPress (with W3 Total Cache)
- WordPress add_rewrite_rules for custom URLs ending in .html
- Rewrite with pagination /foo/page/2/ to posts of a given category, page 2
- Divi change project category slug
- How to add a rewrite endpoint to unattached media?
- How do i add slugs to a URL, but still redirecting to the same page
- Nginx WordPress and another Web app URL structure
- Custom post type url Rewrite (conflicting with page url)
- 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?
- How to deal with a GET variable of ‘name’?
- Disable category RSS Feeds on WordPress blog with PHP
- Prevent Buddypress Rewrite Rules on Non-Buddypress pages/posts
- How to define a rule in functions.php that ONLY disables the default wp functionality that undesirably changes ‘&’ to ‘#038;’?
- How to pass username in affiliate link in wordpress website
- Test the existence of a page/article by its URL, taking in consideration the URL rewriting by filters
- url not using query string no longer working
- Current WordPress Page Title as Search Parameter into A Tag
- How does one make a URL return dynamic JSON with custom Content Type?
- URL rewrite rule
- How does WordPress rewrite URLS using its PHP scripts
- How can I turn a url with get method as a clean url with segment as the get method?
- Redirect homepage /page/1/ to /blog/page/1/
- WordPress Rewrite Issue
- How to print redirected query string variables to the page?
- Multiple URL from Custom post name
- Why isn’t my custom function kicking in from my functions.php file?
- how to exclude admin page from add_rewrite_rule in wordpress
- WordPress rewrite question
- Difference in Get Variable Location
- WordPress adding in site URL to header links
- Dynamically append custom post type to end of url
- WordPress add parameters with friendly url structure
- Custom taxonomy with page post type – WordPress
- Remove slug of multiple custom post types with and without hierarchical
- Enforcing password complexity
- Adding a search form inside a div
- Dynamically change feature image in customiser
- category not display in word press grammatically
- Getting a fatal error while updating
- comments_number display outside specified span
- Get stock by custom meta field on all Woocommerce variable products
- Set a condition based on WooCommerce checkout city field while placing order
- How to create a php variable using WordPress the_title() function
- Way to bulk make all my tags lowercase?
- Create a Blog Template Page
- How to make widget title accept php?
- Function works everywhere, how to keep it to execute when creating a new post
- HTML table attributes ignored
- How can i change variable if condition is not met
- Reading settings in the home page precisely home.php
- Calling function in loop causes repeat data
- How can I include the user id inside of a shortcode php output?
- How to use wp_nav_menu to create custom dropdown menu?
- how to get attached file url for current post?
- Is there a hack for using is_page() within the function.php file?
- the_post(); prints out style text into my HTML?
- Custom function that re-writes page title breaks when the Yoast plugin is activated
- Copying and pasting to WordPress “code editor” code via the front end and clipboard
- update_user_meta as multiple value but with same meta key
- Permalink changes after several minutes after saving post
- AJAX to add to cart multiple products woocommerce
- need to edit php file of child theme to remove an element
- Get value of submit button in custom post type
- wp_delete_attachment not working with multiple values
- my site show this symbol (::) between site title and tagline
- Undefined index notice when using the $args parameter in add_settings_field()
- Saving category as insert post
- How do I get Roboto Google Font to display normal font-style? [closed]
- Save custom field value to variable for conditional – why is this not working? [closed]
- Removing the add to cart button from specific product pages