New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Full friendly URLs configuration for WHMCS on NGINX
Hey all
I posted a reply to this thread a while ago after creating URL rewrites for whmcs, but I think that this deserves its own thread for people looking for it.
This is required as NGINX does not support the .httaccess.
Nevertheless here is the tutorial
https://hostup.org/blog/whmcs-friendly-urls-configuration-for-nginx/
If you have any questions, or if I have missed something in this simple, yet non existant elsewhere let me know on here or on the article itself
Also this is tested for latest WHMCS 7.7
Comments
don't want to step on your toes, but I don't think simply creating a location per rewrite rule is a good way to say at least
on top, you do have quite some blocks doubled up, which you easily can spot, if you sort them a bit better:
for the admin stuff you have redundant blocks which you don't need if you already rewrite the path above anyway
with that in mind, your stuff would already shorten by half ;-)
besides that, you could have a look into the use of basic regular expressions to create something like
just a suggestion, you'll get the idea and could easily bring it down to two rules overall maybe?
I don't use WHMCS so obviously haven't tested it properly, go ahead and play around ;-)
PS: totally forgot, you also might want to look into adding proper flags to the rewrite rule like last ;-)
Yeah I totally agree, it might not be as compact but it works just as good. I am looking to make it more compact though (and I probably will tomorrow):p. I was new to nginx when I wrote this.
I took most of your recommendations and implemented them . The last compact one with the admin panel works great. Nevertheless I removed duplicates and sorted the code a bit more. Thanks for your awesome comment mate, and for helping me understand as well!
It's come to my attention that I have gotten many requests for an updated version via mail and comments. I was wondering if anyone here already has one or would like to contribute to the existing blog post (I'll give you credit + backlink) to help others. I am no longer using NGINX but Litespeed instead so I am not really keeping track of all the changes anymore hence the outdated friendly URL rules.
Thanks!