Welcome! Log In Create A New Profile

Advanced

Joomla custom app, matching and using alias/try_files

Posted by r31griffo 
Joomla custom app, matching and using alias/try_files
December 06, 2018 07:16PM
G'day,

Unfortunately I've only got a limited knowledge of what I'm asking, please forgive me if I use the wrong terminology (this might be why I failed to find the answer on Google).

Currently I have a Joomla site working with Search Engine Friendly URLs, using the following Joomla works great:
try_files $uri $uri/ /index.php?$args;

I'm writing a PHP script that is included inside a Joomla article that will reference the URI to generate its queries to the database, for this to work properly I will need to match all child URI's and display the parent URI (not a redirect).

As an example:
Joomla article (Parent): http://mysite.com/catalogue
Child: http://mysite.com/catalogue/shirt/short-sleeve/page1

In the above example, I would like to still see the "Catalogue" in Joomla but maintain the entire child URI... at the moment if I browse to the child url I get a 404 error.

Thanks in advance,

Brad



Edited 1 time(s). Last edit at 12/06/2018 07:18PM by r31griffo.
Re: Joomla custom app, matching and using alias/try_files
December 06, 2018 11:33PM
This has been my attempt at it after working for several hours... I keep getting 404 errors when trying to match /catalogue/??????, in this case I'd like it to try root /index.php?args.
I've aliased the root and nested PHP fastcgi_param SCRIPT_FILENAME $request_filename thinking that would be it but I'm afraid there's no change.



server {
listen *:80;
server_name mysite.com ;

root /var/www/mysite.com/web/;

if ($http_host != "mysite.com") {
rewrite ^ $scheme://mysite.com$request_uri? permanent;
}

index index.html index.htm index.php index.cgi index.pl index.xhtml;

location ~ /\. {
deny all;
}

location = /favicon.ico {
log_not_found off;
access_log off;
expires max;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}

location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}

location ~ \.php$ {
try_files /fb25ca5e73fd29cfa241f5e05cce00f2.htm @php;
}

location @php {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/lib/php5-fpm/web5.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
}




location ^/catalogue/(.*)$ {
alias /var/www/mysite.com/web/;
try_files $uri $uri/ /index.php?$args;

location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/lib/php5-fpm/web5.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_intercept_errors on;
}

}

client_max_body_size 200M;
try_files $uri $uri/ /index.php?$args;
}
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 112
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready