Welcome! Log In Create A New Profile

Advanced

Can somenone correct my rewrite please

Posted by Jarod 
Can somenone correct my rewrite please
December 26, 2009 07:15AM
Hello,

I upgrade my .htaccess to nginx rewrite. It works but sometimes i have 100% cpu load with php5-cgi on my test server.

This my nginx file :

[code]
server {
listen 80;
server_name mydomain.net www.mydomain.net;


location / {
root /home/mydomain/public_html;
index index.html index.php index.htm;
location ~* ^.+.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|swf|flv)$ {
access_log off;
expires 30d;
break;
}



#rewrite-root
rewrite ^/[^\.]+(\.html)$ /file.php last;

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/mydomain/public_html$fastcgi_script_name;
include fastcgi_params;
}

#photos-zenphotos

location /photos
{
index index.php index.html;
rewrite ^/photos/admin/?$ /photos/zp-core/admin.php redirect;

if (-d $request_filename) {
rewrite ^/photos/albums/?(.+/?)?$ /$1 redirect;
}

if (-e $request_filename) {
break;
}
rewrite index\.php$ /index.php last;
rewrite ^/photos/page/([0-9]+)/?$ /photos/index.php?page=$1 last;
rewrite ^/photos/page/([A-Za-z0-9\-_]+)/?$ /index.php?p=$1 last;
rewrite ^/photos/(.*)/page/([0-9]+)/?$ /photos/index.php?album=$1&page=$2 last;
rewrite ^/photos/(.*)page/([A-Za-z0-9\-_]+)/?$ /photos/index.php?album=$1&p=$2 last;
rewrite ^/photos/page/([A-Za-z0-9\-_]+)/fields([0-9]+)/(.*)/([0-9]+)/?$ /photos/index.php?p=$1&searchfields=$2&words=$3&page=$4 last;
rewrite ^/photos/page/([A-Za-z0-9\-_]+)/fields([0-9]+)/(.*)/?$ /photos/index.php?p=$1&searchfields=$2&words=$3 last;
rewrite ^/photos/page/([A-Za-z0-9\-_]+)/archive/(.*)/([0-9]+)/?$ /photos/index.php?p=$1&date=$2&page=$3 last;
rewrite ^/photos/page/([A-Za-z0-9\-_]+)/archive/(.*)/?$ /photos/index.php?p=$1&date=$2 last;
rewrite ^/photos/page/([A-Za-z0-9\-_]+)/tags/(.*)/([0-9]+)/?$ /photos/index.php?p=$1&searchfields=4&words=$2&page=$3 last;
rewrite ^/photos/page/([A-Za-z0-9\-_]+)/tags/(.*)/?$ /photos/index.php?p=$1&searchfields=4&words=$2 last;
rewrite ^/photos/page/([A-Za-z0-9\-_]+)/(.*)/([0-9]+)/?$ /photos/index.php?p=$1&words=$2&page=$3 last;
rewrite ^/photos/page/([A-Za-z0-9\-_]+)/(.*)/?$ /photos/index.php?p=$1&words=$2 last;
rewrite "^/photos/(.*)/image/(thumb|[0-9]{1,4})/([^/\\\]+)$" /photos/zp-core/i.php?a=$1&i=$3&s=$2 last;
rewrite ^/photos/(.*)/image/([^/\\\]+)$ /photos/zp-core/i.php?a=$1&i=$2 last;
rewrite "^/photos/(.*)/album/(thumb|[0-9]{1,4})/([^/\\\]+)$" /photos/zp-core/i.php?a=$1&i=$3&s=$2&album=true last;
rewrite ^/photos/(.*)/?$ /photos/index.php?album=$1 last;

}

#ads
location /ads{
index index.php index.html;

rewrite ^/ads/(.*)$ /ads/index.php?page=$1 last;
rewrite ^/ads/c,(.*),Keyword.htm$ /ads/index.php last;

}


location ~ /\.ht {
deny all;
}



# vbseo (forum rewrite vbulletin)
location /forum
{
index index.php index.html;
rewrite ^/((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ /vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 last;

if (!-e $request_filename)
{
rewrite ^/forum/(.*)$ /forum/vbseo.php last;
}
}
if ($request_filename ~ "\.php$" )
{
rewrite ^/forum/([^/]*)$ /forum/vbseo.php last;
}


}

}
[/code]


.htaccess code for ads:

[code]
RewriteEngine on
RewriteBase /ads

RewriteRule ^c,(.*),Keyword.htm$ index.php [R=301,L]
RewriteCond %{REQUEST_URI} (/|\.htm|\.html|/[^.]*)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^rss([0-9]{0,}),(.*).html$ rss.php?cat=$1 [L]
RewriteRule (.*) index.php?page=$1&%{QUERY_STRING}
RewriteRule templates\/(.*).tpl$ index.php[F]
RewriteRule templates_c\/(.*) index.php[F]
RewriteRule configs\/(.*).conf$ index.php [F]

#RewriteRule ^(.*)http(.*)$ index.php [R=301]
#RewriteRule ^p-(.*).html$ index.php?page=$1 [L]
[/code]



htaccess on root
[code]
RewriteRule ^[^\.]+(\.html)?$ file.php [QSA,E=url_propre:$0,L]

[/code]


Thanks :)
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 110
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready