Welcome! Log In Create A New Profile

Advanced

Zend Rewrite

Posted by marshall2056 
Zend Rewrite
May 02, 2011 02:26PM
Hello all !

i have a bit of a problem with rewrite rules and i dont know what to do anymore .. any content i found online is not to use for me :S

first :
i have a url like
www.domain.com/cityes/city/c/somecity
where :
cityes is controller
city is action
c is param
somecity is value of c

i want now rewrite this link to : www.domain.com/city/somecity

secound :
i have url like :
www.domain.com/cityes/city/c/somecity/id/12/topic/topic-name
where :
cityes is controller
city is action
c is param
somecity is value of c
id is param
12 is value of id
topic is param
topic-name is value of topic

i want this url to be rewriten like : www.domain.com/city/somecity/topic-name-12 (with or withoud ending .html)

my server conf :

server {
listen 80;
server_name www.domain.com;
root /var/www/www.domain.com/public;
index /index.php;

access_log /var/log/nginx/www.domain.com.access.log;
error_log /var/log/nginx/www.domain.com.error.log;


location /city/ {
rewrite ^/([a-zA-Z_0-9\-]+)/?$ /cityes/city//c/$1 last; // this is not working :S
}

location / {
if (-e $request_filename) {
#rewrite ^/(.*)$ /index?/$1 last;
break;
}

fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /var/www/www.domain.com/public/index$
#fastcgi_param QUERY_STRING $query_string;

fastcgi_param APPLICATION_ENV development;

}

location ~* ^.+.(css|js|jpeg|jpg|gif|png|ico) {
expires 30d;
}
}

thank you for youre help and sorry for my eng
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 215
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready