Rewrite or return directives for discuz v3.1

hello;
I want to write a block to put in my VHOST config file.
i want

  1. if there is “/install/index.php/” in the link. it shouldbe removed
    from
    the link.
  2. if the format is like /uc_server/blab.php/uc_server/blahblah ===it
    should change to===>/uc_server/blabal

what should I put in my VHOST config file and where?

my current VHOST format is :

server {
    server_name  www.DOMAINNAME;
    rewrite ^(.*) http://DOMAINNAME$1 permanent;
}

server {
        listen 80;
        server_name DOMAINNAME;
                root   /var/www/DOMAINNAME/htdocs;
                index index.php;
    include /etc/nginx/security;

# Logging --
access_log  /var/log/nginx/DOMAINNAME.access.log;
error_log  /var/log/nginx/DOMAINNAME.error.log notice;

        # serve static files directly
        location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ {
            access_log        off;
            expires           max;
        }

        location ~ \.php$ {
    try_files $uri =404;
                fastcgi_pass unix:/var/run/php5-fpm/DOMAINNAME.socket;
                fastcgi_index index.php;
                include /etc/nginx/fastcgi_params;
        }
}

Posted at Nginx Forum:

On 4 December 2013 07:54, r004 [email protected] wrote:

hello;
I want to write a block to put in my VHOST config file.
i want

  1. if there is “/install/index.php/” in the link. it shouldbe removed from
    the link.
  2. if the format is like /uc_server/blab.php/uc_server/blahblah ===it
    should change to===>/uc_server/blabal

what should I put in my VHOST config file and where?

What part are you having difficulties with?

Have you read the documentation for “location” and “rewrite”? Have a
read of that, and then let us know if you’re still having a problem.

J

On Wed, Dec 04, 2013 at 02:54:30AM -0500, r004 wrote:

Hi there,

  1. if there is “/install/index.php/” in the link. it shouldbe removed from
    the link.

In the rewrite line, capture the parts before and after
/install/index.php/, and rewrite to those parts without the middle bit.

  1. if the format is like /uc_server/blab.php/uc_server/blahblah ===it
    should change to===>/uc_server/blabal

What does “format is like” mean? urls that start with something, or that
end with something, or that include a specific pattern somewhere?

Which parts of the input are used to make the output?

If you can write down how the matching should happen, the rewrite rule
should become clear.

http://nginx.org/r/rewrite

f

Francis D. [email protected]