I have 2 websites,
http://localhost/bb
-- phpbb
http://localhost/dp
-- Drupal
I wish to redirect $server_name/bb/ucp.php?mode=logout&sid=xxxxx
to $server_name/dp/user/logout
, the sid should be ignored.
I've tried this:
location /bb/
{
index index.php;
if ($query_string ~* "mode=logout$")
{
rewrite ^/bb/ucp\.php http://$server_name/dp/user/logout redirect;
}
}
It seems not working. Could anyone help? Thanks.
I tried this too:
location /bb/
{
index index.php;
if ($arg_mode ~* "logout") ## and = instead of ~* too.
{
rewrite ^/bb/ucp\.php http://$server_name/dp/user/logout redirect;
}
}
but it doesn't work either.
Current Whole config:
server {
listen 80;
server_name localhost;
add_header X-Frame-Options "SAMEORIGIN";
client_max_body_size 500M;
root /var/www;
location / {
index index.html index.htm index.php;
try_files $uri @rewrite;
}
location /bb/
{
index index.php;
if ($arg_mode = "logout")
{
rewrite ^/bb/ucp\.php http://$server_name/dp/user/logout redirect;
}
}
location @rewrite {
# needed by Drupal
rewrite ^/([^/]*)/(.*)(/?)$ /$1/index.php?q=$2&$args;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
(Doesn't work as expected)