how can i avoid google index my site properly jail directory only allow html extension.

lifeisjustabout nginx-forum at
Tue Mar 19 08:10:57 UTC 2013

I have small pdf search site searches pdf over internet when somebody search
URL look like  with (html

google index this address with html and without html version so there are
duplicate record on google index each search lies without html  and with html version

what i would like to do is if i can make it around without html version
( will be returned 404 page rather than
200 it could be also jail /pdf/ directory only allow html if html couldn't
find go to nginx 404 page.

I am not nginx guru but the newbie if you send me exactly location where i
put suggested code i would be highly appreciated 

thank you very much for your help

my nginx conf is below 

server {


         # log_format  awstatcomp  '$host $remote_addr - $remote_user
[$time_local] "$request" ' '$status $body_bytes_sent "$$

       #  access_log /var/log/nginx/ main;
        access_log /var/log/nginx/ awstatcomp;
         error_log /var/log/nginx/;
         root /home/mypdfwebsite/www;
         index index.php index.html;

        location / {
                try_files $uri $uri/ /index.php?q=$request_uri;

     location ~ \.php$ {
             #root html;
             fastcgi_index index.php;
             fastcgi_param SCRIPT_FILENAME
             include fastcgi_params;

         location ~ /\. { deny all; }

        location ~ \.pl$ {
          gzip off;
          include /etc/nginx/fastcgi_params;
          #fastcgi_pass unix:/tmp/php.sock;
          #statistic perl  
          fastcgi_param  SCRIPT_FILENAME       
          deny all;


Posted at Nginx Forum:,237527,237527#msg-237527

More information about the nginx mailing list