Answer the question
In order to leave comments, you need to log in
Converting .htaccess to NGINX - how?
Hello everybody! There is a site root, there are two folders in it
appand
publicnext to it lies .htaccess with the code
RewriteEngine on
RewriteRule ^(.*) public/$1 [L]
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*)$ $1 [L]
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
server {
listen 127.0.0.1:80;
server_name localhost;
root home/localhost/public_html;
index index.php index.html;
log_not_found off;
access_log logs/localhost-access.log main;
charset utf-8;
#convert htaccess
location / {
rewrite ^/(.*) /public/$1 break;
}
location /public/ {
if (-e $request_filename){
rewrite ^(.*)$ /public/$1 break;
}
rewrite ^(.*)$ /index.php?url=$1 break;
}
#convert htaccess
location ~ /\. { deny all; }
location = /favicon.ico { }
location = /robots.txt { }
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9071;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
include fastcgi_params;
}
}
Answer the question
In order to leave comments, you need to log in
server {
listen 127.0.0.1:80;
server_name localhost;
root /home/localhost/public_html/public;
index index.php;
log_not_found off;
access_log logs/localhost-access.log main;
charset utf-8;
location / {
try_files $uri $uri/ @php;
}
location @php {
rewrite ^/(.*) /index.php?url=$1;
}
location ~ /\. { deny all; }
location = /favicon.ico { }
location = /robots.txt { }
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9071;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
www.anilcetin.com/convert-apache-htaccess-to-nginx
winginx.com/ru/htaccess
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question