<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yui_3_16_0_1_1447256973870_4471">Hello Francis,</div><div id="yui_3_16_0_1_1447256973870_4505"><br></div><div id="yui_3_16_0_1_1447256973870_4574">First thank you for your answers<br></div><div id="yui_3_16_0_1_1447256973870_4575" dir="ltr"><br></div><div id="yui_3_16_0_1_1447256973870_4576" dir="ltr">I tried both methods but none of them worked. I'm going to look at it more in details (and display the php logs because I just had a blank page).</div><div id="yui_3_16_0_1_1447256973870_4577" dir="ltr"><br></div><div id="yui_3_16_0_1_1447256973870_4578" dir="ltr">Also I would like to know why the solution you're offering is a "best practice" ?</div><div id="yui_3_16_0_1_1447256973870_4579" dir="ltr">At first it seems a bit heavy because I'll have a paragraph like that for every x variable (x=information, x=something). Considering also that the users URL might not look like the x variable.</div><div id="yui_3_16_0_1_1447256973870_4624" dir="ltr">nginx.org/info_1234 is an internal rewrite of index.php?x=information</div><div id="yui_3_16_0_1_1447256973870_4750" dir="ltr"><br></div><div id="yui_3_16_0_1_1447256973870_4751" dir="ltr">I tried two other solutions that worked</div><div id="yui_3_16_0_1_1447256973870_4754" dir="ltr">rewrite /info_1234 /index.php?x=information;<br class="" id="yui_3_16_0_1_1447256973870_4753"></div><div id="yui_3_16_0_1_1447256973870_5549" dir="ltr">and<br></div><div id="yui_3_16_0_1_1447256973870_5548" dir="ltr">location = /info_1234 { try_files info_1234 /index.php?x=information; }</div><div id="yui_3_16_0_1_1447256973870_5595" dir="ltr"><br></div><div id="yui_3_16_0_1_1447256973870_5596" dir="ltr">I would like to understand why your solution is better than these, why is it a best practice ?</div><div id="yui_3_16_0_1_1447256973870_5639" dir="ltr"><br></div><div id="yui_3_16_0_1_1447256973870_5640" dir="ltr">Thank you<br></div><div id="yui_3_16_0_1_1447256973870_4580" dir="ltr"><br></div><div id="yui_3_16_0_1_1447256973870_4396"><span></span></div> <br><div class="qtdSeparateBR"><br><br></div><div style="display: block;" class="yahoo_quoted"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div dir="ltr"> <font face="Arial" size="2"> Le Mercredi 11 novembre 2015 16h47, Francis Daly <francis@daoine.org> a écrit :<br> </font> </div> <blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; margin-top: 5px; padding-left: 5px;"> <br><br> <div class="y_msg_container">On Wed, Nov 11, 2015 at 02:29:37PM +0000, Mik J wrote:<br clear="none"><br clear="none">Hi there,<br clear="none"><br clear="none">> > I want that a user who accessesnginx.org/informationwill be redirected in the background tonginx/index.php?x=informationSo that my index.php page is dymanic<br clear="none">> <br clear="none">> What does "redirected in the background" mean?M => I just meant that the user won't see the php parameters. He just sees a simple url with text only.Nginx passes the parameter to php, and not the user (through GET). That's what I meant by "in the background"<br clear="none"><br clear="none">That's clear, thanks. In nginx terms, it's an internal rewrite.<br clear="none"><br clear="none">> > I did like this in my virtual host configurationlocation /information { try_files information /index.php?x=information; }<br clear="none">> > I would like to know if:a) This is the best practice to do what I would like to do ?<br clear="none">> <br clear="none">> I'd say "no".<br clear="none">> <br clear="none">> I'm not fully sure what it is that you want to do, but I suspect that<br clear="none">> "rewrite" (<a shape="rect" href="http://nginx.org/r/rewrite" target="_blank">http://nginx.org/r/rewrite</a>) may be what you want; unless<br clear="none">> you will describe how /index.php is intended to be handled -- in which<br clear="none">> case just using (e.g.) fastcgi_pass with some suitable fastcgi_param<br clear="none">> directives might be even better.<br clear="none">> M => My index.php looks like this<?php<br clear="none">> if ($_GET['x']) == 'information') { echo "This is the information Page"; } <br clear="none">> if ($_GET['x']) == 'contact') { echo "This is the contact Page"; } <br clear="none">> ?><br clear="none"><br clear="none">Your nginx will have some way to cause your index.php to be<br clear="none">processed. Maybe it is proxy_pass to a php-enabled web server; maybe it<br clear="none">is fastcgi_pass to a fastcgi server, maybe it is something else.<br clear="none"><br clear="none">If you do something like<br clear="none"><br clear="none"> location = /information { rewrite ^ /index.php?x=information; }<br clear="none"> location = /index.php {<br clear="none"> fastcgi_pass ...;<br clear="none"> fastcgi_param SCRIPT_FILENAME $document_root$uri;<br clear="none"> fastcgi_param QUERY_STRING $query_string;<br clear="none"> }<br clear="none"><br clear="none">then you could instead omit the rewrite, and just do something like<br clear="none"><br clear="none"> location = /information {<br clear="none"> fastcgi_pass ...;<br clear="none"> fastcgi_param SCRIPT_FILENAME $document_root/index.php;<br clear="none"> fastcgi_param QUERY_STRING x=information;<br clear="none"> }<br clear="none"><br clear="none">directly.<div class="yqt5004028959" id="yqtfd98624"><br clear="none"><br clear="none"> f</div><br clear="none">-- <br clear="none">Francis Daly <a shape="rect" ymailto="mailto:francis@daoine.org" href="mailto:francis@daoine.org">francis@daoine.org</a><br clear="none"><br clear="none">_______________________________________________<br clear="none">nginx mailing list<br clear="none"><a shape="rect" ymailto="mailto:nginx@nginx.org" href="mailto:nginx@nginx.org">nginx@nginx.org</a><br clear="none"><a shape="rect" href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><div class="yqt5004028959" id="yqtfd59001"><br clear="none"></div><br><br></div> </blockquote> </div> </div> </div></div></body></html>