我是新來nginx的,我不知道如何使用的.htaccess nginx的,哪裏放置生成的代碼在nginx的configuration.could請人幫我將它轉換爲nginx的?如何在nginx中使用.htaccess以及在哪裏放置它?
這裏是我的.htaccess文件
<IfModule mod_rewrite.c>
RewriteCond ${REQUEST_URI} ^.+$
RewriteCond %{REQUEST_FILENAME} \.(admin)$ [OR]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -l
RewriteRule^- [L]
RewriteCond %{QUERY_STRING} [^a-z](cast|char|convert|declare|delete|drop|exec|insert|meta|script|select|set|truncate|update)[^a-z] [NC]
RewriteRule (.*) - [F]
RewriteEngine On
# redirect with username
Options +FollowSymLinks
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(admin|assets|include)(.*)?$ /$1$2 [L,QSA,R=301]
RewriteRule ^user/([a-zA-Z0-9_-]+)$ user.php?username=$1
RewriteRule ^user/([a-zA-Z0-9_-]+)/$ user.php?username=$1
RewriteRule ^media/([a-zA-Z0-9_-]+)$ media.php?id=$1
RewriteRule ^media/([a-zA-Z0-9_-]+)/$ media.php?id=$1
RewriteRule ^tag/([^/.]+)$ tag.php?tag=$1 [QSA,L]
RewriteRule ^tag/([^/.]+)/$ tag.php?tag=$1 [QSA,L]
# turn on the mod_rewrite engine
RewriteCond %{REQUEST_FILENAME}.php -f
# IF the request filename with .php extension is a file which exists
RewriteCond %{REQUEST_URI} !/$
# AND the request is not for a directory
RewriteRule (.*) $1\.php [L]
# redirect to the php script with the requested filename
</IfModule>
請幫我將它轉換爲nginx的,引導我在哪裏正是把這個代碼。謝謝!
nginx的不使用(讀)的.htaccess,只與Apache – Mark
是的,但有一種方法來轉換htaccess的nginx的吧? –