Hi, My project using phalcon 2.1 on Nginx server
- .htaccess on root public_html
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteRule ^templates - [L,NC]
RewriteRule ^themes - [L,NC]
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
</IfModule>
- .htaccess on /public folder
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]
</IfModule>
I have use convert htaccess to nginx: https://winginx.com/en/htaccess But my web only run home page. This is my config nginx
server {
server_name www.fdola.com;
rewrite ^(.*) https://fdola.com$1 permanent;
}
server {
listen 80 default_server;
access_log off;
error_log off;
# error_log /home/fdola.com/logs/error.log;
root /home/fdola.com/public_html;
include /etc/nginx/conf/ddos2.conf;
index index.php index.html index.htm;
server_name fdola.com;
# nginx configuration. convert from .htaccess root
location / {
if ($http_host ~* "^www\.(.*)$"){
rewrite ^(.*)$ https://%1/$1 redirect;
}
rewrite ^/$ /public/ break;
rewrite ^(.*)$ /public/$1 break;
}
# nginx configuration, convert htaccess /public
charset utf-8;
location /public {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?_url=/$1 break;
}
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_connect_timeout 120;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 256k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;
fastcgi_param SCRIPT_FILENAME /home/fdola.com/public_html$fastcgi_script_name;
}
}
it only work on home page , not work on page rewrite think it's not right on this content, please help me!
location /public {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?_url=/$1 break;
}
}