Merhabalar.

NGINX sunucuda aşağıdaki rewrite kurallarını uygulamaki istiyorum :

rewrite ^/u/(.*)/$ http://sitename.com/index.php?author_name=$1;
rewrite ^/u/(.*)/page/?(.*)$ http://sitename.com/index.php?author_name=$1&paged=$2;
rewrite ^/u/(.*)/followers$ http://sitename.com/index.php?author_name=$1&type=followers;
rewrite ^/u/(.*)/comments$ http://sitename.com/index.php?author_name=$1&type=comments;
rewrite ^/u/(.*)/watchs$ http://sitename.com/index.php?author_name=$1&type=watchs;
rewrite ^/u/(.*)/watch$ http://sitename.com/index.php?author_name=$1&type=watch;
rewrite ^/u/(.*)/series$ http://sitename.com/index.php?author_name=$1&type=series;
rewrite ^/u/(.*)/notifications$ http://sitename.com/index.php?author_name=$1&type=notifications;
rewrite ^/u/(.*)/settings$ http://sitename.com/index.php?author_name=$1&type=settings;
rewrite ^/u/(.*)/lp$ http://sitename.com/index.php?author_name=$1&type=lost_password;
http://sitename.com/u/admin/ bu adrese gittiğimde http://sitename.com/?author_name=admin bu sayfaya yönlendiriliyor.

Oysa adres çubuğunda ilk yazdığım adresin (http://sitename.com/u/admin/) görünmesini ve arkaplanda ikinci yazdığım adresin (http://sitename.com/index?author_name=admin) işlenmesini istiyorum.


Denediğim diğer yollar :

1) Aşağıdaki kodu uyguladığımda yukarıdakiyle aynı sonucu veriyor.

location /u {
rewrite ^/u/(.*)/$ http://sitename.com/index.php?author_name=$1;
rewrite ^/u/(.*)/page/?(.*)$ http://sitename.com/index.php?author_name=$1&paged=$2;
rewrite ^/u/(.*)/followers$ http://sitename.com/index.php?author_name=$1&type=followers;
rewrite ^/u/(.*)/comments$ http://sitename.com/index.php?author_name=$1&type=comments;
rewrite ^/u/(.*)/watchs$ http://sitename.com/index.php?author_name=$1&type=watchs;
rewrite ^/u/(.*)/watch$ http://sitename.com/index.php?author_name=$1&type=watch;
rewrite ^/u/(.*)/series$ http://sitename.com/index.php?author_name=$1&type=series;
rewrite ^/u/(.*)/notifications$ http://sitename.com/index.php?author_name=$1&type=notifications;
rewrite ^/u/(.*)/settings$ http://sitename.com/index.php?author_name=$1&type=settings;
rewrite ^/u/(.*)/lp$ http://sitename.com/index.php?author_name=$1&type=lost_password;
}
2) Aşağıdaki kodu uyguladığımda http://sitename.com/u/admin/watchs adresi http://sitename.com/?author_name=admin/watchs adresine yönlendiriliyor ve 404 bulunamadı sayfası çıkıyor tabi.

location /u {
rewrite ^/u/(.*)/?$ http://sitename.com/index.php?author_name=$1;
rewrite ^/u/(.*)/page/(.*)/?$ http://sitename.com/index.php?author_name=$1&paged=$2;
rewrite ^/u/(.*)/followers/?$ http://sitename.com/index.php?author_name=$1&type=followers;
rewrite ^/u/(.*)/comments/?$ http://sitename.com/index.php?author_name=$1&type=comments;
rewrite ^/u/(.*)/watchs/?$ http://sitename.com/index.php?author_name=$1&type=watchs;
rewrite ^/u/(.*)/watch/?$ http://sitename.com/index.php?author_name=$1&type=watch;
rewrite ^/u/(.*)/series/?$ http://sitename.com/index.php?author_name=$1&type=series;
rewrite ^/u/(.*)/notifications/?$ http://sitename.com/index.php?author_name=$1&type=notifications;
rewrite ^/u/(.*)/settings/?$ http://sitename.com/index.php?author_name=$1&type=settings;
rewrite ^/u/(.*)/lp/?$ http://sitename.com/index.php?author_name=$1&type=lost_password;
}
3) Aşağıdaki kodu uyguladığımda 1.kodla aynı sonucu veriyor.

location /u {
rewrite ^/u/([w-]+)/?$ http://sitename.com/index.php?author_name=$1;
rewrite ^/u/([w-]+)/page/([w-]+)/?$ http://sitename.com/index.php?author_name=$1&paged=$2;
rewrite ^/u/([w-]+)/followers/?$ http://sitename.com/index.php?author_name=$1&type=followers;
rewrite ^/u/([w-]+)/comments/?$ http://sitename.com/index.php?author_name=$1&type=comments;
rewrite ^/u/([w-]+)/watchs/?$ http://sitename.com/index.php?author_name=$1&type=watchs;
rewrite ^/u/([w-]+)/watch/?$ http://sitename.com/index.php?author_name=$1&type=watch;
rewrite ^/u/([w-]+)/series/?$ http://sitename.com/index.php?author_name=$1&type=series;
rewrite ^/u/([w-]+)/notifications/?$ http://sitename.com/index.php?author_name=$1&type=notifications;
rewrite ^/u/([w-]+)/settings/?$ http://sitename.com/index.php?author_name=$1&type=settings;
rewrite ^/u/([w-]+)/lp/?$ http://sitename.com/index.php?author_name=$1&type=lost_password;
}
4) Aşağıdaki kodu uyguladığımda adres çubuğu istediğim gibi kalıyor ama 404 sayfa bulunamadı hatası veriyor.

location /u {
rewrite ^/u/([w-]+)/?$ /index.php?author_name=$1;
rewrite ^/u/([w-]+)/page/([w-]+)/?$ /index.php?author_name=$1&paged=$2;
rewrite ^/u/([w-]+)/followers/?$ /index.php?author_name=$1&type=followers;
rewrite ^/u/([w-]+)/comments/?$ /index.php?author_name=$1&type=comments;
rewrite ^/u/([w-]+)/watchs/?$ /index.php?author_name=$1&type=watchs;
rewrite ^/u/([w-]+)/watch/?$ /index.php?author_name=$1&type=watch;
rewrite ^/u/([w-]+)/series/?$ /index.php?author_name=$1&type=series;
rewrite ^/u/([w-]+)/notifications/?$ /index.php?author_name=$1&type=notifications;
rewrite ^/u/([w-]+)/settings/?$ /index.php?author_name=$1&type=settings;
rewrite ^/u/([w-]+)/lp/?$ /index.php?author_name=$1&type=lost_password;
}
5) Aşağıdaki kodu uyguladığımda 4.kodla aynı sonucu veriyor.


location /u {
rewrite ^/u/([w-]+)/page/([0-9]+)/?$ /index.php?author_name=$1&paged=$2;
rewrite ^/u/([w-]+)/?$ /index.php?author_name=$1;
rewrite ^/u/([w-]+)/followers/?$ /index.php?author_name=$1&type=followers;
rewrite ^/u/([w-]+)/comments/?$ /index.php?author_name=$1&type=comments;
rewrite ^/u/([w-]+)/watchs/?$ /index.php?author_name=$1&type=watchs;
rewrite ^/u/([w-]+)/watch/?$ /index.php?author_name=$1&type=watch;
rewrite ^/u/([w-]+)/series/?$ /index.php?author_name=$1&type=series;
rewrite ^/u/([w-]+)/notifications/?$ /index.php?author_name=$1&type=notifications;
rewrite ^/u/([w-]+)/settings/?$ /index.php?author_name=$1&type=settings;
rewrite ^/u/([w-]+)/lp/?$ /index.php?author_name=$1&type=lost_password;
}
Nginx ayar dosyası aşağıdaki gibi :

server {
server_name www.sitename.com;
rewrite ^(.*) http://sitename.com$1 permanent;
listen 8080;
}
server {
listen 8080;
access_log off;
# access_log /home/sitename.com/logs/access_log;
error_log on;
# error_log /home/sitename.com/logs/error.log;
#add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
root /home/sitename.com/public_html;
include /etc/nginx/conf/ddos2.conf;
# include /etc/nginx/conf/cors.conf;
index index.php index.html index.htm;
server_name sitename.com;
try_files $uri $uri/ /index.php?$query_string;
#modsecurity on;
#modsecurity_rules_file /etc/nginx/modsec/main.conf;





location /u {
rewrite ^/u/([w-]+)/page/([w-]+)/?$ /index.php?author_name=$1&paged=$2;
rewrite ^/u/([w-]+)/followers/?$ /index.php?author_name=$1&type=followers;
rewrite ^/u/([w-]+)/comments/?$ /index.php?author_name=$1&type=comments;
rewrite ^/u/([w-]+)/watchs/?$ /index.php?author_name=$1&type=watchs;
rewrite ^/u/([w-]+)/watch/?$ /index.php?author_name=$1&type=watch;
rewrite ^/u/([w-]+)/series/?$ /index.php?author_name=$1&type=series;
rewrite ^/u/([w-]+)/notifications/?$ /index.php?author_name=$1&type=notifications;
rewrite ^/u/([w-]+)/settings/?$ /index.php?author_name=$1&type=settings;
rewrite ^/u/([w-]+)/lp/?$ /index.php?author_name=$1&type=lost_password;
rewrite ^/u/([w-]+)/?$ /index.php?author_name=$1;
}




error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
internal;
}

location ~ .php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_connect_timeout 250;
fastcgi_send_timeout 250;
fastcgi_read_timeout 250;
fastcgi_buffer_size 256k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;
fastcgi_param SCRIPT_FILENAME /home/sitename.com/public_html$fastcgi_script_name;
}

include /etc/nginx/conf/drop.conf;

    }