The issue:

I’m using (what I think is) a fairly standard multisite WordPress setup, which is using qTranslate for internationalisation. I have a menu that generates links of the form:

http://www.example.com/theblog/thepage/?lang=XX

However, going there returns a 302, and redirects to

http://www.example.com/theblog/thepage

without the slash and without the query parameters (thus switching the language to default).

I am not very good with mod_rewrite nor WordPress, so I would appreciate if someone could help me debug exactly what is happening. My hypothesis is there is a rogue redirect going on to remove the slash; but I can’t see any rule in .htaccess that would account for it - unless WordPress itself was doing it, for some reason. Here is what rewrite log says (edited for brevity and anonymity):

...[rid#...a0/initial] (3) [perdir /...] add path info postfix: /var/www/wordpress/theblog -> /var/www/wordpress/theblog/thepage
...[rid#...a0/initial] (3) [perdir /...] strip per-dir prefix: /var/www/wordpress/theblog/thepage -> theblog/thepage
...[rid#...a0/initial] (3) [perdir /...] applying pattern '^index.php$' to uri 'theblog/thepage'
...[rid#...a0/initial] (3) [perdir /...] add path info postfix: /var/www/wordpress/theblog -> /var/www/wordpress/theblog/thepage
...[rid#...a0/initial] (3) [perdir /...] strip per-dir prefix: /var/www/wordpress/theblog/thepage -> theblog/thepage
...[rid#...a0/initial] (3) [perdir /...] applying pattern '^([_0-9a-zA-Z-]+/)?files/(.+)' to uri 'theblog/thepage'
...[rid#...a0/initial] (3) [perdir /...] add path info postfix: /var/www/wordpress/theblog -> /var/www/wordpress/theblog/thepage
...[rid#...a0/initial] (3) [perdir /...] strip per-dir prefix: /var/www/wordpress/theblog/thepage -> theblog/thepage
...[rid#...a0/initial] (3) [perdir /...] applying pattern '^([_0-9a-zA-Z-]+/)?wp-admin$' to uri 'theblog/thepage'
...[rid#...a0/initial] (3) [perdir /...] add path info postfix: /var/www/wordpress/theblog -> /var/www/wordpress/theblog/thepage
...[rid#...a0/initial] (3) [perdir /...] strip per-dir prefix: /var/www/wordpress/theblog/thepage -> theblog/thepage
...[rid#...a0/initial] (3) [perdir /...] applying pattern '^' to uri 'theblog/thepage'
...[rid#...a0/initial] (4) [perdir /...] RewriteCond: input='/var/www/wordpress/theblog' pattern='-f' => not-matched
...[rid#...a0/initial] (4) [perdir /...] RewriteCond: input='/var/www/wordpress/theblog' pattern='-d' => not-matched
...[rid#...a0/initial] (3) [perdir /...] add path info postfix: /var/www/wordpress/theblog -> /var/www/wordpress/theblog/thepage
...[rid#...a0/initial] (3) [perdir /...] strip per-dir prefix: /var/www/wordpress/theblog/thepage -> theblog/thepage
...[rid#...a0/initial] (3) [perdir /...] applying pattern '^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*)' to uri 'theblog/thepage'
...[rid#...a0/initial] (3) [perdir /...] add path info postfix: /var/www/wordpress/theblog -> /var/www/wordpress/theblog/thepage
...[rid#...a0/initial] (3) [perdir /...] strip per-dir prefix: /var/www/wordpress/theblog/thepage -> theblog/thepage
...[rid#...a0/initial] (3) [perdir /...] applying pattern '^[_0-9a-zA-Z-]+/(.*.php)$' to uri 'theblog/thepage'
...[rid#...a0/initial] (3) [perdir /...] add path info postfix: /var/www/wordpress/theblog -> /var/www/wordpress/theblog/thepage
...[rid#...a0/initial] (3) [perdir /...] strip per-dir prefix: /var/www/wordpress/theblog/thepage -> theblog/thepage
...[rid#...a0/initial] (3) [perdir /...] applying pattern '.' to uri 'theblog/thepage'
...[rid#...a0/initial] (2) [perdir /...] rewrite 'theblog/thepage' -> 'index.php'
...[rid#...a0/initial] (3) [perdir /...] add per-dir prefix: index.php -> /var/www/wordpress/index.php
...[rid#...a0/initial] (2) [perdir /...] trying to replace prefix /var/www/wordpress/ with /
...[rid#...a0/initial] (5) strip matching prefix: /var/www/wordpress/index.php -> index.php
...[rid#...a0/initial] (4) add subst prefix: index.php -> /index.php
...[rid#...a0/initial] (1) [perdir /...] internal redirect with /index.php [INTERNAL REDIRECT]
...[rid#...68/initial/redir#1] (3) [perdir /...] strip per-dir prefix: /var/www/wordpress/index.php -> index.php
...[rid#...68/initial/redir#1] (3) [perdir /...] applying pattern '^index.php$' to uri 'index.php'
...[rid#...68/initial/redir#1] (1) [perdir /...] pass through /var/www/wordpress/index.php
...[rid#...a0/initial] (3) [perdir /...] strip per-dir prefix: /var/www/wordpress/favicon.ico -> favicon.ico
...[rid#...a0/initial] (3) [perdir /...] applying pattern '^index.php$' to uri 'favicon.ico'
...[rid#...a0/initial] (3) [perdir /...] strip per-dir prefix: /var/www/wordpress/favicon.ico -> favicon.ico
...[rid#...a0/initial] (3) [perdir /...] applying pattern '^([_0-9a-zA-Z-]+/)?files/(.+)' to uri 'favicon.ico'
...[rid#...a0/initial] (3) [perdir /...] strip per-dir prefix: /var/www/wordpress/favicon.ico -> favicon.ico
...[rid#...a0/initial] (3) [perdir /...] applying pattern '^([_0-9a-zA-Z-]+/)?wp-admin$' to uri 'favicon.ico'
...[rid#...a0/initial] (3) [perdir /...] strip per-dir prefix: /var/www/wordpress/favicon.ico -> favicon.ico
...[rid#...a0/initial] (3) [perdir /...] applying pattern '^' to uri 'favicon.ico'
...[rid#...a0/initial] (4) [perdir /...] RewriteCond: input='/var/www/wordpress/favicon.ico' pattern='-f' => not-matched
...[rid#...a0/initial] (4) [perdir /...] RewriteCond: input='/var/www/wordpress/favicon.ico' pattern='-d' => not-matched
...[rid#...a0/initial] (3) [perdir /...] strip per-dir prefix: /var/www/wordpress/favicon.ico -> favicon.ico
...[rid#...a0/initial] (3) [perdir /...] applying pattern '^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*)' to uri 'favicon.ico'
...[rid#...a0/initial] (3) [perdir /...] strip per-dir prefix: /var/www/wordpress/favicon.ico -> favicon.ico
...[rid#...a0/initial] (3) [perdir /...] applying pattern '^[_0-9a-zA-Z-]+/(.*.php)$' to uri 'favicon.ico'
...[rid#...a0/initial] (3) [perdir /...] strip per-dir prefix: /var/www/wordpress/favicon.ico -> favicon.ico
...[rid#...a0/initial] (3) [perdir /...] applying pattern '.' to uri 'favicon.ico'
...[rid#...a0/initial] (2) [perdir /...] rewrite 'favicon.ico' -> 'index.php'
...[rid#...a0/initial] (3) [perdir /...] add per-dir prefix: index.php -> /var/www/wordpress/index.php
...[rid#...a0/initial] (2) [perdir /...] trying to replace prefix /var/www/wordpress/ with /
...[rid#...a0/initial] (5) strip matching prefix: /var/www/wordpress/index.php -> index.php
...[rid#...a0/initial] (4) add subst prefix: index.php -> /index.php
...[rid#...a0/initial] (1) [perdir /...] internal redirect with /index.php [INTERNAL REDIRECT]
...[rid#...28/initial/redir#1] (3) [perdir /...] strip per-dir prefix: /var/www/wordpress/index.php -> index.php
...[rid#...28/initial/redir#1] (3) [perdir /...] applying pattern '^index.php$' to uri 'index.php'
...[rid#...28/initial/redir#1] (1) [perdir /...] pass through /var/www/wordpress/index.php

I’d be grateful if someone could puzzle out why this happens, what makes it happen, and how I can stop it from happening.

Read more here: WordPress redirect loses parameters


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: