rewrite help for w2box

Igor Sysoev is at rambler-co.ru
Thu May 14 15:14:53 MSD 2009


On Thu, May 14, 2009 at 06:38:48AM -0400, lblasc wrote:

> No luck with rewrite for w2box. Can I get some help with this ?
> 
> apache .htaccess :
> 
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{QUERY_STRING} ^$
> RewriteRule ^(.*)$ index.php?d=$1&BAD_HOSTING=%{HTTP:Authorization} 
> 
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{QUERY_STRING} ^(.+)$
> RewriteRule ^(.*)$ index.php?%1&d=$1&BAD_HOSTING=%{HTTP:Authorization} 
> 	
> RewriteCond %{QUERY_STRING} ^(.*)$
> RewriteRule (.+).php $1.php?%1&BAD_HOSTING=%{HTTP:Authorization}

It's a sealed book to me why w2box developers moved this query string
logic from PHP reach scripting to ugly RewriteRules.

If you use fastcgi, you may try:

server {

  ....

  if ($args) {
      set $args  $args&;
  }

  location / {
      try_files  $uri  $uri/ /index.php?${args}d=$uri;
  }

  location ~ \.php$ {
      try_files  $uri  $uri/ /index.php?${args}d=$uri;

      fastcgi_pass     ...;
      fastcgi_param    QUERY_STRING  ${args}&BAD_HOSTING=$http_authorization;
      ...
  }

  location = /index.php {
      fastcgi_pass     ...;
      fastcgi_param    QUERY_STRING  ${args}&BAD_HOSTING=$http_authorization;
      ...
  }


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list