Pages rewrite

Hi Guys,

I need a help on below topic and I wanted to achieve URL Rewrite like
this

We want to redirect our domain pages from source to destination one

Source : Original Page
www.xxxx.com/index.php?id=news

Destination :
www.xxxxx.com/news.html

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

Hi Team,

Any update I am still failing to achieve the same? How do I rewrite the
URLs

Posted at Nginx Forum:
https://forum.nginx.org/read.php?2,264068,264120#msg-264120

On Fri, Jan 22, 2016 at 01:00:31PM -0500, blason wrote:

Hi there,

I need a help on below topic and I wanted to achieve URL Rewrite like this

We want to redirect our domain pages from source to destination one

Source : Original Page
www.xxxx.com/index.php?id=news

Destination :
www.xxxxx.com/news.html

Option 1 - do it in php.

Write an index.php that will issue suitable 301 redirects for whatever
arguments it gets.

Option 2 - do it in nginx.conf.

In your “location = /index.php” block, use the appropriate logic.

If you know you will always get exactly one “id” parameter that will
always map to the obvious new url, something like

return 301 /$arg_id.html;

(untested) would probably work. If you have different logic – what
should happen with a request for /index.php?id=news&key=value, or for
/index.php?id1=news, or for /index.php?id=news&id=help, or for
/index.php
– then when you describe your intention, it may become obvious how to
implement it.

If it is straightforward, then http://nginx.org/r/map and examples
may help; if it is not, you may find it simpler to work in a different
language such as php.

(Note: in the above I have assumed that the source and destination
hostnames are the same. If they really are not, and the number of x’s is
intentionally different, then you would need to include the full http://
url in the return directive.)

Good luck with it,

f

Francis D. [email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs