<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><P>I have the following configuration for vhost:</P><P><BR></P><P><BR>server {<BR>            listen   80;<BR>            server_name  www.mydomain.com;<BR>                        <BR>                        #redirect www to non-www<BR>            rewrite ^/(.*) http://mydomain.com/$1 permanent;<BR>            <BR>                        <BR>       }<BR><BR><BR>server {<BR>                        listen   80;<BR>                        server_name mydomain.com;<BR>            access_log /home/mydomain/log/access.log;<BR>            error_log /home/mydomain/log/error.log;<BR>                        <BR>                        <BR>                        <BR>            location /  {<BR>                                root   /home/mydomain/public_html/;<BR>                                index  index.php index.html;      <BR>                                expires 30d;<BR>                                                <BR>                                #stop image and files hotlinking<BR>                                location ~* ^.+\.(gif|jpg|png|swf|flv|rar|zip|jpeg|css)$ {<BR>                                valid_referers none blocked mydomain.com www.mydomain.com *.google.com *.yahoo.com;<BR>                                if ($invalid_referer) {<BR>                        
        return 444;<BR>                                }<BR>                                }<BR>                                                <BR>                                #joomla sef url's<BR>                                if (!-e $request_filename) {<BR>                                        rewrite  ^(.*)$  /index.php?q=$1  last;<BR>                                        break;<BR>                                                                }<BR>                                        }<BR>                                                <BR>                                if ( $args ~ "mosConfig_[a-zA-Z_]{1,21}(=|\%3d)" ) {<BR>                                set $args "";<BR>                                rewrite ^.*$ http://$host/index.php last;<BR>                                return 403;<BR>                                }<BR><BR>                                if ( $args ~ "base64_encode.*\(.*\)" ) {<BR>                                set $args "";<BR>                                rewrite ^.*$ http://$host/index.php last;<BR>                                return 403;<BR>                                }<BR><BR>                                if ( $args ~ "(\&lt;|%3C).*script.*(\&gt;|%3E)" ) {<BR>                                set $args "";<BR>                                rewrite ^.*$ http://$host/index.php last;<BR>                                return 403;<BR>                                }<BR>                        <BR>                                if ( $args ~ "GLOBALS(=|\[|\%[0-9A-Z]{0,2})" ) {<BR>                                set $args "";<BR>                                rewrite ^.*$ http://$host/index.php last;<BR>                                return 403;<BR>                                }<BR><BR>                                if ( $args ~ "_REQUEST(=|\[|\%[0-9A-Z]{0,2})" ) {<BR>                                set $args "";<BR>                                rewrite ^.*$ http://$host/index.php last;<BR>                        
        return 403;<BR>                                }<BR>                            <BR>                                <BR>                        <BR>            # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000<BR>            location ~ \.php$ <BR>                                    {<BR>            fastcgi_pass 127.0.0.1:9000;<BR>            fastcgi_index index.php;<BR>            include /usr/local/nginx/conf/fastcgi_params;<BR>            fastcgi_param SCRIPT_FILENAME /home/mydomain/public_html/$fastcgi_script_name;<BR>                        }<BR>       <BR>                  <BR>          <BR>                 <BR>                 }<BR></P><P><BR></P><P>I tried what you suggested but it doesn't work or I didn't add it properly.</P><BR>--- On <B>Wed, 10/14/09, Igor Sysoev <I>&lt;is@rambler-co.ru&gt;</I></B> wrote:<BR><BLOCKQUOTE style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><BR>From: Igor Sysoev &lt;is@rambler-co.ru&gt;<BR>Subject: Re: index.php 301 redirect<BR>To: nginx@sysoev.ru<BR>Date: Wednesday, October 14, 2009, 4:10 PM<BR><BR><DIV
 class="plainMail">On Wed, Oct 14, 2009 at 05:25:39AM -0700, SE7EN wrote:<BR><BR>&gt; I want to redirect all calls to <A href="http://mydomain.com/index.php" target="_blank">http://mydomain.com/index.php</A> to <A href="http://mydomain.com" target="_blank">http://mydomain.com</A> to avoid duplicate pages.I use this<BR>&gt; if ($request_uri ~* "^/index.php\??$") {<BR>&gt;     rewrite ^.*$ <A href="http://$host" target="_blank">http://$host</A>? permanent;<BR>&gt; }<BR>&gt; <BR>&gt; but it doesn't seem to work properly. Although it redirects I cannot login or logout anymore in Joomla, it simply redirect to homepage without login or logout. What am i missing here ? How do i do this properly ? Of course if i remove that everything i fine, it works for example for home.html but not for index.php.<BR>&gt; Thank you.<BR><BR>The right way is to use<BR><BR>   location = /index.php {<BR>       rewrite ^  <A href="http://$host"
 target="_blank">http://$host</A>? permanent;<BR>   }<BR><BR>However, if you have the following configuration:<BR><BR>   location / {<BR>       index  index.php;<BR>   }<BR><BR>   location = /index.php {<BR>       rewrite ^  <A href="http://$host" target="_blank">http://$host</A>? permanent;<BR>   }<BR><BR>then the "/" request will be internally redirected to "/index.php".<BR>Therefore you should use something<BR><BR>   location = /index.php {<BR>       if ($request_uri = /index.php) {<BR>           rewrite ^  <A href="http://$host" target="_blank">http://$host</A>? permanent;<BR>       }<BR><BR>       ...<BR>   }<BR><BR>How do login and logout URLs look ?<BR><BR><BR>-- <BR>Igor Sysoev<BR><A href="http://sysoev.ru/en/" target="_blank">http://sysoev.ru/en/</A><BR><BR></DIV></BLOCKQUOTE></td></tr></table><br>