Hi all,
I am trying to convert this htaccess file to nginx config and it is not
working.
Here is my .htaccess
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*)$ $1 [QSA,L]
RewriteCond $1
!^(#(.)|?(.)|.htaccess(.)|.htaccess.back(.)|.idea/(.)|.svn/(.)|admin.php(.)|content/(.)|download.php(.)|ecc/(.)|images/(.)|index.php(.)|install/(.)|login.php(.)|readme.txt(.)|robots.txt(.))
RewriteRule ^(.+)$ index.php?url=$1&%{QUERY_STRING} [L]
and here is my config. I can get it to somewhat work if I only use one
of
the following lines but then the rest is broke!
location / {
if ($query_string ~ “^$”){
rewrite ^/((.)?)$ /index.php?p=home break;
}
if (-e $request_filename){
rewrite ^(.*)$ /$1 break;
}
rewrite ^(.+)$ /index.php?url=$1&$query_string break;
location ~ .php$ {
try_files $uri =404;
fastcgi_pass unix:/tmp/php5-fpm.sock;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
}
Not to mention that I hate using the if else clauses in my nginx config
because I think I read where it is poor for performance.
Can someone give me a hand here. I have been working on this for hours
without any luck.
John
Posted at Nginx Forum: