i fixed it using the apache proxy module:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} !location
RewriteRule ^(boston|newyork)/$ /index.php?location=$1 [NC,QSA,P]
RewriteCond %{QUERY_STRING} !location
RewriteRule ^(boston|newyork)/(.*)$ /$2?location=$1 [NC,QSA,P]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
the [P] option does the trick.
Related Posts:
- How to create custom URL routes?
- Masking wp-content/themes/name/images to just images directory using htaccess
- How to change default page slug?
- Mod_rewrite delete parameter in 301 Redirect
- When to call `add_rewrite_rule` for safety
- Sub domain redirection to taxonomy
- Need to make a php file inside theme accessible via url
- Evaluating a external rewrite rule before internal wordpress rewrite rule
- Using custom mod_rewrite without breaking wordpress permalinks
- Rewrite rule to load images from production does nothing
- Rewrite Rules Are Redirecting and Not Passing VARs
- WordPress rewrite rules don’t need ^?
- Adding rewrite rules directly to .htaccess file
- Custom rewrite not working
- WP is ignoring .htaccess rewritten URL
- a one-off rewrite rule
- Rewrite wp-login.php URLS to static pages?
- Need help with simple rewrite rule (shouldn’t this be easy?)
- Change htaccess to redirect to index.php in subfolder
- Rewrite custom post type URL parameters
- How to remove wordpress directory slash
- Rewrite URLs – Custom Post Type – Post Slug, Taxonamy Slug
- URL Rewriting for PHP script on an image URL
- Change pagination url format
- How to redirect specific URL to Subdomain
- Rewriting “pretty” blog category URL with htaccess / add_rewrite_rule() causes 404 page
- How to rewrite wordpress urls with index.php in them
- Custom Rewrite rule to captured post (rewrite rule to rewrite rule)
- Map secondary domain to other’s virtual subfolder
- URL rewriting with custom user meta “/%shop_name%/gallery/%gallery%”
- Changing URL scheme, mod_rewrite not helping
- Localize URL bases
- How can I create custom URL routes?
- force www rewrite if wordpress put in a folder
- Rewriting a date hierarchy into a ‘yyyy-mm-dd’ slug
- How do I make WordPress revise an .htaccess file a certain way?
- How to change an existing wordpress page rewrite rule?
- Pretty URL via Rewrite
- ModRewrite not working properly
- Custom Rewrite for Profiles
- Function to rewrite URl in WordPress
- help with rewrite_tag and rewrite_rule for custom page GET variables [duplicate]
- Can’t get pretty permalinks to work without index.php
- How to redirect a virtual page (e.g. /blog) to the home page?
- Please give me the rewrite rules for my ugly urls
- Add rewrite endpoint and .htaccess
- Is it possible to use the same slug structure for a taxonomy and for some pages?
- Generic htaccess redirect www to non-www
- Change the “page” slug in pagination
- Understanding add_rewrite_rule
- “.#[random-char-string]” being inserted at end of URLs
- Is the SEO plugin necessary?
- How do I add a add_rewrite_rule without it redirecting?
- How to prepend route with /blog for blog listing page only
- Dynamically redirect page based on URL?
- Changing WordPress blog name and web address
- htaccess: Remove trailing slash from URL ending with .xml/ only
- Regionalised Content
- Custom URL rewrite to specific page template
- Changing the search URL?
- add new permalink structure from dynamic page
- Have two different URLs show the homepage
- How to change home or site url using action hooks or filter?
- Get url-friendly version of the_title?
- Rewrite ugly URL to clean URL
- Url rewrite on index.php?term=[term_name]
- Rewrite: WordPress URL rewrite on Search
- WPML language switcher for custom rewrite rules
- How can I change the permalink of a translated home page?
- Add word to permalink when custom field has a value
- simple add_rewrite_rule added, refuses to work
- URL Rewrite and add_query_var not working
- Rewrite permalink for specific posts
- Retrieve query var within functions.php
- rewrite rule generated with mpdf to a shorter version
- Name page template properly
- Show Mysql table elements as pages in WordPress
- WP in subfolder hidden by htaccess, but media links show the subfolder
- One off rewrite for single post-type slug (show normal page with same URL instead)
- .htm re-write is adding an ending / to my URL bar
- Import images from self-hosted to WordPress.com
- Help with WordPress custom url rewriting?
- Page not found: Custom search form with a custom search page
- Query vars to return the homepage
- dynamic URL rewrite
- How wordpress core include search.php with $_GET[‘s’]?
- How to remove Base URL Duplication?
- WordPress doesn’t remember my custom rewrite rule
- Custom urls in WordPress involving page slugs
- how to change some of the rules in the database
- Rewriting URLs with query strings and preserving them
- how rewrite is working in wordpress
- How to prevent URL-modification when page title contains digits only?
- How do I display a friendly URL link in the frontend?
- rewriting an Url
- Spurious URL structure (Adding extra /0/s)
- WordPress fallback rewrite
- rewrite for subpage seems to loose parameter
- URL Rewriting in WordPress for only one specific page
- How to change the url of the archive page to be inside the custom post type