Page 1 of 1

Pretty URLs on Nginx? Howto??

Posted: Thu Jan 21, 2021 12:39 am
by jradxl
The documentation at:
https://docs.cmsmadesimple.org/configuration/pretty-url

when using other webserver, in my case, Nginx to add at end config.php:-

Code: Select all

$config['url_rewriting'] = 'internal';
The above is straightforward.

It then says:-

Code: Select all

Step 2
The head section of your HTML template should contain the tag:
{metadata}
Which I don't understand.
I'm using the free bandb design

Where do I add this?
Via Admin?
or am I supposed to edit a file?

Re: Pretty URLs on Nginx? Howto??

Posted: Thu Jan 21, 2021 3:57 am
by DIGI3
The {metadata} tag is already in the bandb_master template.

Re: Pretty URLs on Nginx? Howto??

Posted: Fri Jan 22, 2021 12:43 am
by jradxl
Many thanks for reply.

I have now sorted out my URLs without the "index.php" running on Nginx, as follows...
1. Was using Vivaldi browers on Ubuntu 20.10, and it was giving me strange urls.
The problem isn't using Firebox and Chrome.

2.Yes, {metadata}, is in the bandb_master template, which can be found in Admin, at the path, Layout > Design Manager, then select "bandb_master" in the first Template tab, and it's a few lines down near <head>

2. My Config.php looks like this. Note that 'url_rewriting' = 'mod_rewrite', because I'm using a Nginx statement that emulates that on Apache.

Code: Select all

$config['assume_mod_rewrite'] = 'false';
$config['page_extension'] = '';
$config['use_hierarchy'] = 'false';
$config['url_rewriting'] = 'mod_rewrite';
$config['internal_pretty_urls'] = 'false';
$config['root_url'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'] . '/cmsms';
3.My Nginx site.conf has this:-

Code: Select all

location /cmsms
    {
        try_files $uri $uri/ /cmsms/index.php?page=$request_uri;
    }
4. A URL on my test site looks like this:-

Code: Select all

http://www.XXXX.dynu.net/cmsms/news/1/1/News-Info
It was definitely Vivaldi that was confusing this issue.
Hope this helps anyone searching in the future.
Suggest the documentation is enhanced to make it easier for beginners

Re: Pretty URLs on Nginx? Howto??

Posted: Fri Jan 22, 2021 8:13 am
by KO
I have that typical

Code: Select all

$config['url_rewriting'] = 'mod_rewrite';
in config.php and

Code: Select all

location / {
     try_files $uri $uri/ /index.php?page=$request_uri ;
}
in NGINX settings for that domain. Pretty URLs work perfectly fine :)

Please look at here https://www.nginx.com/resources/wiki/st ... de_simple/