Rewrite help for w2box


#1

Hello,

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}

Thanks !

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,2018,2018#msg-2018


#2

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

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;

}