Welcome! Log In Create A New Profile

Advanced

Migrating from APache to Nginx, need help rewrite

Posted by antonhilman 
Migrating from APache to Nginx, need help rewrite
February 20, 2015 02:00AM
here is my .htaccess somebody please help me write the nginx version. i used converter but didnt works well. please help me and add comment the code please.

------------------------------------[begin]--------------------------
# 404 ERROR NOT FOUND PAGE
ErrorDocument 404 /404.php

# 301 REDIRECT add WWW
RewriteCond %{HTTP_HOST} ^website.com$ [NC]
RewriteRule ^(.*)$ http://www.website.com/$1 [r=301,nc]

# IP Canonicalization/ change IP to domain name
RewriteCond %{HTTP_HOST} ^111\.222\.333\.444
RewriteRule (.*) http://www.website.com/$1 [R=301,L]

# NO rewrite for exact file/folder name. ex: website.com/index.php and website.com/admin
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# modul. ex: website.com/news and website.com/news/page/3
RewriteRule ^([^/]+)/?$ index.php?mod=$1 [QSA,L]
RewriteRule ^([^/]+)/page/([0-9]+)/?$ index.php?mod=$1&page=$2 [QSA,L]

#detail content. ex: website.com/news/123/title-news.html or website.com/news/123/title-news or website.com/news/123
RewriteRule ^([^/]+)/([0-9]+)/[^/]+\.html$ index.php?mod=$1&id=$2 [QSA,L]
RewriteRule ^([^/]+)/([0-9]+)/([^/]+)/?$ index.php?mod=$1&id=$2 [QSA,L]
RewriteRule ^([^/]+)/([0-9]+)/?$ index.php?mod=$1&id=$2 [QSA,L]
-------------------------------[end]--------------------------------

thanks
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 286
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready