UPDATE

I attempted while using internal wordpress rewrite. What I must do is definitely an address such as this:

http://example.com/galleria/artist-title

delivered to the gallery.php page having a variable that contains the artist-title.

I made use of these rules according to Wordpress' documentation:

// REWRITE RULES (per gallery) wordpress_rewrite

    $wordpress_rewrite->flush_rules()



// Adding a brand new rule

function wordpress_insertMyRewriteRules($rules)



// Adding the id var to ensure that Wordpress recognizes it

function wordpress_insertMyRewriteQueryVars($vars)



what's strange now's that on my small local wordpress test install, that actually works fine: the gallery page is known as and also the galleryname variable is passed. Around the real site, however, the first URL is recognized (as with it does not get into a 404) However it changes to http://example.com/gallery (I am talking about it really alterations in the browser's address bar) and also the variable isn't defined in gallery.php.

Any idea what might cause this different behavior?

Alternatively, every other way I could not think about that could attain the same effect referred to within the first three lines is perfectly fine.


Old question

What I have to do is spinning this address:

(1) http://localhost/wordpress/fake/text-value

to

(2) http://localhost/wordpress/gallery?somevar=text-value

Notes:

  • the remapping should be transparent: the consumer always needs to see address (1)
  • gallery is really a permalink to some wordpress page, not really a real address

I essentially have to rewrite the address first (to change it) after which feed it to mod rewrite again (to allow wordpress parse it its very own way).

Problems

basically function

RewriteRule ^fake$ http://localhost/wordpress/gallery [L]

it really works however the address within the browser changes, that is not good, basically do

RewriteRule ^fake$ /wordpress/gallery [L]

I recieve a 404. I attempted different flags rather than [L] but with no success. How do i get this work?

EDIT: full .htaccess

# BEGIN WordPress

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteRule ^fake$ /wordpress/gallery [R]

RewriteBase /wordpress/

RewriteCond % !-f

RewriteCond % !-d

RewriteRule . /wordpress/index.php [L]

</IfModule>

# Finish WordPress

Do this rule:

RewriteRule ^fake/([^/]+)$ gallery?somevar=$1 [L]

Solved, it had been the Permalink Redirect wordpress plugin which must be set up to skip the preferred "virtual" Web addresses, else it might problem a 301 Permanently moved.

Apologies for that very-postponed answer here, however i believe what you ought to do is exactly what Gumbo recommended however with adding the passthrough/PT flag:

This flag forces the rewrite engine to create the uri area from the internal request_rec structure to the need for the filename area.
...
You have to make use of this flag if you wish to mix directives from different modules which permit URL-to-filename translators.

Although Wordpress (via mod_php) runs after mod_rewrite is performed, it normally will get the initial (pre-rewrite) uri, also it uses that to complete its very own internal spinning, as opposed to the re-written filename value.

So try:

RewriteRule ^fake/([^/]+)$ gallery?somevar=$1 [QSA,PT]

I added QSA to ensure that, just just in case someone visited /wordpress/fake/something?page=3, it'll get passed along correctly. Tell me how that actually works.