나는 nginx에 새로 왔으며 .htaccess를 nginx와 함께 사용하는 방법을 모르며 어디에서 생성 된 코드를 nginx configuration.could에 넣을 수 있습니까? 아무도 이걸 nginx로 변환하도록 도와 주시겠습니까?nginx와 함께 .htaccess를 사용하는 방법과 어디에 넣을까요?
여기 nginx에 어디 정확히이 코드를 넣어 나를 인도하는이 변환 도와주세요 내 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는 (읽기)의 .htaccess를 사용하지 않는, 오직 그래 – Mark
을 아파치하지만 지금 nginx에 할 htaccess로 변환하는 방법이? –