How can I rewrite all:
/subscribe?foo=bar
into
/subscribe/?foo=bar
(note the trailing slash)
I’ve tried variations on this with no luck:
location / {
root /var/www/docs/site.com/secure;
index index.html index.htm index.php;
rewrite ^/subscribe?(.*) /subscribe/?$1 permanent;
}
location /subscribe {
index index.php;
rewrite ^/subscribe?(.*) /?$1 permanent;
}
Thanks,
Jeff
Also if it matters, this is a php URL being handled by fastcgi.
Made some progress, but now the query_string is being doubled.
location /subscribe {
index index.php;
rewrite ^/subscribe$ /subscribe/index.php?$query_string permanent;
}
The above just about does it, but I end up now going from
/subscribe?foo=bar
to:
/subscribe/index.php?foo=bar?foo=bar
If I don’t put in the $query_string, then I get nothing at all.
Any help on what I’m doing wrong?
Thanks,
Jeff
[SOLVED]
For posterity, here’s how I got it working:
I ended up adding this to my root location /
if ($request_filename !~* .*\.(jpg|jpeg|gif|css|png|js|ico)$) {
rewrite ^/subscribe([^\/]*)$ /subscribe/index.php$1 permanent;
}
Seems to do the trick.
-Jeff
On Wed, May 05, 2010 at 10:36:29AM +0000, [email protected] wrote:
Yes it should be rewrite to
http://www.example.com/site/yahoo/test/article
Is there any way to do this?
location / {
proxy_pass http://www.example.com/site/yahoo/;
}
What error do you see with this configuration ?
It works already on index. But when i accessing
On Wed, May 05, 2010 at 03:22:36PM +0700, Glen L. wrote:
However it’s not rewrited. It’s being redirected to
server_name google.example.com;
Subject: Re: rewrite help
I have www.example.com, google.example.com, yahoo.example.com
–
nginx mailing list
nginx Info Page
nginx mailing list
[email protected]
nginx Info Page
–
Igor S.
http://sysoev.ru/en/
When I open /test/article, it’s redirected to index page again
Best Regards,
Glen L.
On Wed, May 05, 2010 at 10:56:40AM +0000, [email protected] wrote:
When I open /test/article, it’s redirected to index page again
The request may be proxied to nginx itself, to
server {
listen 80;
server_name www.example.com;
Try to set backedn address in
proxy_pass http://www.example.com/site/yahoo/;
instead of www.example.com.
On Wed, May 05, 2010 at 10:36:29AM +0000, [email protected] wrote:
What error do you see with this configuration ?
giving me bad gateway
is better than
server {
To: [email protected]
[email protected]
nginx mailing list
[email protected]
nginx Info Page
nginx mailing list
[email protected]
nginx Info Page
–
Igor S.
http://sysoev.ru/en/