Forum for discussing general topics related to Couch.
27 posts Page 2 of 3
Thanks for update. If you check my sample, I didn't use any quotes, specifically to let Couch take it as variable.

Also what happens if page_id is not a real page id?

As to rewrite rules, try /couch/gen_htaccess.php and see if it works with new routes.
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
I use NGINX not Apache, so rewrite rules are pretty difficult to come up with :(
Try to generate htaccess rules and convert them to nginx http://winginx.com/en/htaccess
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
trendoman wrote: Try to generate htaccess rules and convert them to nginx http://winginx.com/en/htaccess


These converters almost never work, I have "unknown "0" variable" now with yours. I think I will make a separate topic about Nginx, I can't be the only one without Apache.

I had it working before I had routes
Perhaps the following thread could help with porting the rewrite rules to nginx -
https://www.couchcms.com/forum/viewtopic.php?f=2&t=9301
Thanks, the Nginx topic I already used to make my working rules. But since I have now made the routing setup, nothing seems to work correctly.

I have now working links like this, that load correct blog post and language, based on the URL:

Code: Select all
http://MYDOMAIN.lv/obj.php?q=lv/ziguri


but although Prettyurls is enabled, and documentation says, this should work, it doesn't:

Code: Select all
http://MYDOMAIN.lv/obj/lv/ziguri


The routing debug shows that there is nothing in the path to match, I wonder why? Maybe my Nginx config messes something up?

Code: Select all
Path to match: 

Trying route lv_obj:
Pattern: lv/{:page_name}
Regex: lv/(?P<page_name>[^/]+)
Failed!
Reason: Not a regex match.


But If this would be an Nginx issue, it wouldn't load the page at all. It does, it just doesn't want to see the path.

This is what it shows when all works (with the regular, non pretty url):

Code: Select all
Path to match: lv/ziguri

Trying route lv_obj:
Pattern: lv/{:page_name}
Regex: lv/(?P<page_name>[^/]+)
Matched!


As you can see, "path to match" is empty when I use the Prettyurl style.

Documentation here does not say that I need anything special, just change the url ...
Thanks for update.

I can't help here, as I have zero experience with Nginx.
What I do know is that if prettyurls are enabled without proper rewriting rules, it's impossible to reach http://MYDOMAIN.lv/obj/ instead of http://MYDOMAIN.lv/obj.php So, no matter what kind of routes the template has, it can't be found by server.

What I suggest is to try creating a simple rule to rewrite obj.php into obj and obj/
Also, would be nice to add a {:slash} to the definition, to make it easier to config. So the route will match with or without slash and it will not influence anything.
Code: Select all
path='{:page_id}{:slash}' 

Code: Select all
<cms:route_constraints  slash='(\/?)'  />
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
It does already work with this (no .php) so I guess nginx rules do work to some extent:

Code: Select all
http://MYDOMAIN.lv/obj?q=lv/ziguri


will try your suggestion
still no path to match

this matches:


http://DOMAIN.lv/obj?q=lv/ziguri
Path to match: lv/ziguri
Trying route lv_obj:
Pattern: lv{:slash}{:page_name}
Regex: lv(?P<slash>\/?)(?P<page_name>[^/]+)
Matched!


this does not:

http://DOMAIN.lv/obj/lv/ziguri
Path to match:
Trying route lv_obj:
Pattern: lv{:slash}{:page_name}
Regex: lv(?P<slash>\/?)(?P<page_name>[^/]+)
Failed!
Reason: Not a regex match.


Path to match is empty.

My route now:

Code: Select all
      
<cms:route name='lv_obj' path='lv{:slash}{:page_name}'>
     <cms:route_constraints  slash='(\/?)'  />
</cms:route>   
@normis, could you please post the conf file containing the rewrite rules you are using?
27 posts Page 2 of 3