How to redirect internally?

Hi,

I have created a config so that a URL like
www.mysite.com/abc/electronics.html is rewritten as
www.mysite.com/index.php/electronics.html?store=abc.

This is what I see in Mozilla Firebug

GET abc/electronics.html

301 Moved Permanently

GET index.php/electronics.html?store=abc

200 OK

What is annoying is that the browser now shows the rewritten URL and not
the pretty URL. How can we ensure that the redirection happens only
internally?

Thanks,
Yash

On 27 July 2012 13:12, Yash G. [email protected] wrote:

GET index.php/electronics.html?store=abc
200 OK

What is annoying is that the browser now shows the rewritten URL and not the
pretty URL. How can we ensure that the redirection happens only internally?

If you’re rewriting from/to inside the same server{} stanza, you can
investigate using the “last” flag in the rewrite documentation:
http://nginx.org/r/rewrite

I don’t know how you can achieve this across different server{}s (with
the obvious proviso that you can have more than one server_name in a
server{}).

HTH,
Jonathan

Jonathan M.
Oxford, London, UK
http://www.jpluscplusm.com/contact.html

On Fri, Jul 27, 2012 at 05:42:17PM +0530, Yash G. wrote:

Hi there,

I have created a config so that a URL like
www.mysite.com/abc/electronics.html is rewritten as
www.mysite.com/index.php/electronics.html?store=abc.

What is annoying is that the browser now shows the rewritten URL and not
the pretty URL. How can we ensure that the redirection happens only
internally?

http://nginx.org/r/rewrite

rewrites are internal, unless you do something to turn them into
redirects
(= external).

What is the rewrite directive you are using? Are are you doing anything
the documentation says makes it become a redirect?

f

Francis D. [email protected]

I suggest you show your wider config and some verbose curl -v output
against nginx.

On 29 July 2012 05:02, Yash G. [email protected] wrote:

www.mysite.com/index.php/electronics.html?store=abc.
What is the rewrite directive you are using? Are are you doing anything


nginx mailing list
[email protected]
nginx Info Page


Jonathan M.
Oxford, London, UK
http://www.jpluscplusm.com/contact.html

All the rewrites are marked as last. e.g.
rewrite ^/([a-zA-Z]+)(.*) $2?store=$1 last;