# Nginx location, return and rewrite directives

**URL:** <https://www.ruby-forum.com/t/nginx-location-return-and-rewrite-directives/237926>\
**Category:** NGINX\
**Created:** [December 6, 2013, 9:46am UTC](https://www.ruby-forum.com/t/nginx-location-return-and-rewrite-directives/237926 "2013-12-06T09:46:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [December 6, 2013, 9:46am UTC](https://www.ruby-forum.com/t/nginx-location-return-and-rewrite-directives/237926/1 "2013-12-06T09:46:36Z")

</div>

I am having a hard time learning to do return and rewrite directives.

the conditions are fuzzy for me.  
I am trying to learn by example, so I made one up.  
in the htdocs of my server we have this file and folders.

~:#\>ls htdocs  
admin.php  
api (dir)  
api.php  
archiver (dir)  
config (dir)  
connect.php  
cp.php  
crossdomain.xml  
data (dir)  
favicon.ico  
forum.php  
group.php  
home.php  
index.php  
install (dir)  
member.php  
misc.php  
plugin.php  
portal.php  
robots.txt  
search.php  
source (dir)  
static (dir)  
template (dir)  
uc\_client (dir)  
uc\_server (dir)  
userapp.php

NOW; we just focus on the uc\_server client ;  
~:#\> ls /htodcs/uc\_server  
admin.php  
api (dir)  
avatar.php  
control (dir)  
crossdomain.xml  
data (dir)  
images (dir)  
index.php  
install (dir)  
js (dir)  
lib (dir)  
model (dir)  
plugin (dir)  
release (dir)  
robots.txt  
view (dir)

A.) So what is happening is in uc\_server; I think we are better to  
create a  
block location like  
location /uc\_server/ {

```
     }

```

and do or conditional directives in there right???

B.) I want these to happen:

[http://DOMAIN.DOM/uc\_server/admin.php/uc\_server/](http://DOMAIN.DOM/uc_server/admin.php/uc_server/) ===changes to===\>  
[http://DOMAIN.DOM/uc\_server/](http://DOMAIN.DOM/uc_server/)

AND

if there is …/install/index.php/… ( the “/install/index.php/”  
pattern somewhere in the link) in any requested links ;the  
“/install/index.php/” part would be omitted and the link would processed  
without that part.  
THANKS ALOT

Posted at Nginx Forum:

> **[Nginx location, return and rewrite directives](https://forum.nginx.org/read.php?2,245275,245275#msg-245275)**
>
> I am having a hard time learning to do return and rewrite directives. the conditions are fuzzy for me. I am trying to learn by example, so I made one up. in the htdocs of my server we have this file and folders. ~:#\>ls htdocs admin.php api
