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
- How to Dynamically Change the author_base URL Slug by Language in WordPress?
- WordPress add_rewrite_rule not working with page_on_front
- Default Image not showing up in Customizer for WP_Customize_Cropped_Image_Control
- List categories assigned to a post
- Shortcode in a $output statement
- Call get_template_part() custom permalink
- Singleton plugin activation; create database
- Transfer WordPress Login Session to an Extended Webpage on the Same Domain
- Calling header from JavaScript file
- WooCommerce remove_action and add_action [closed]
- Need help with PHP functions
- Insert div after every three posts in home.php [duplicate]
- Using get_the_excerpt in edit-post
- Get a list of tags present in a paged front page
- I want different post-thumbnail size depending on media size
- Is it possible to dupplicate a WordPress post with php?
- Adding a number to a date
- Highlight Single Page Ancestor
- Popular Post Not Show
- How do you change the tag font size in the repeater-template.php [closed]
- WordPress WPDB::insert 13th param is always blank (only if format)
- How to create a radio button to alt between settings in wp_options table
- I want to use wordpress database in android app using json encode?
- Pull a div from one WordPress site into another WordPress site
- PHP tag in post content makes wordpress go crazy
- woocommerce plugin bugs
- truncating imported rss-feeds
- Ajax not updating to database
- How can the searchform.php know if it’s used on a registered sidebar id ‘sidebar-1’ or ‘sidebar-2’?
- Latest Post Thumbnail Alt Text Missing
- Custom YouTube Plugin loading different PHP library on live site and localhost
- WordPress 404 when using AJAX to call php function
- How to hide the Duplicate taxonomy values in WordPress?
- Display product_brand with get_the_terms function
- Issue in url update when using wordpress update query
- Add Alt attribute to image served with php