{"id":45,"date":"2019-04-13T11:39:00","date_gmt":"2019-04-13T11:39:00","guid":{"rendered":"https:\/\/hostup.org\/blog\/?p=45"},"modified":"2021-05-02T22:50:34","modified_gmt":"2021-05-02T22:50:34","slug":"whmcs-friendly-urls-configuration-for-nginx","status":"publish","type":"post","link":"https:\/\/hostup.se\/en\/blog\/whmcs-friendly-urls-configuration-for-nginx\/","title":{"rendered":"WHMCS 7.8 Friendly URLs Configuration for Nginx"},"content":{"rendered":"\n<p>Hi there again! If you are like me and want to use the friendly URLs option with <a href=\"https:\/\/hostup.org\/blog\/how-to-install-configure-latest-nginx-mainline-version-on-ubuntu\/\" target=\"_blank\" rel=\"noopener\">Nginx<\/a> on <a href=\"https:\/\/www.whmcs.com\/\" target=\"_blank\" rel=\"noopener\">WHMCS<\/a>, but noticed that it does not work, then you have come to the right place.<\/p>\n\n\n\n<p>If you don&#8217;t already have a VPS, or want to reward us for hard work and ad free experience you can buy a <a href=\"https:\/\/hostup.org\/vps\" target=\"_blank\" rel=\"noopener\">VPS<\/a> from us. We would really appreciate it as we don&#8217;t have any donation buttons and this is our only source of income. Our VPSes are located in Stockholm, and we even have a <a href=\"https:\/\/hostup.se\/vps\">Swedish branded site <\/a>if you&#8217;re from Sweden.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why Add SEO Friendly URLs?<\/h2>\n\n\n\n<p>Friendly URLs both look good for the user, is easier to remember and additionally help search engines, such as Google better understand your website.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"398\" height=\"35\" src=\"https:\/\/hostup.org\/blog\/wp-content\/uploads\/2021\/01\/image-1-1.png\" alt=\"\" class=\"wp-image-48\" srcset=\"https:\/\/hostup.se\/en\/blog\/wp-content\/uploads\/2021\/01\/image-1-1.png 398w, https:\/\/hostup.se\/en\/blog\/wp-content\/uploads\/2021\/01\/image-1-1-300x26.png 300w\" sizes=\"auto, (max-width: 398px) 100vw, 398px\" \/><figcaption>An example of a regular URL<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"399\" height=\"36\" src=\"https:\/\/hostup.org\/blog\/wp-content\/uploads\/2021\/01\/image-2.png\" alt=\"\" class=\"wp-image-50\" srcset=\"https:\/\/hostup.se\/en\/blog\/wp-content\/uploads\/2021\/01\/image-2.png 399w, https:\/\/hostup.se\/en\/blog\/wp-content\/uploads\/2021\/01\/image-2-300x27.png 300w\" sizes=\"auto, (max-width: 399px) 100vw, 399px\" \/><figcaption>An example of an SEO friendly URL<\/figcaption><\/figure>\n\n\n\n<p><br><\/p>\n\n\n\n<script async=\"\" src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\n<ins class=\"adsbygoogle\" style=\"display:block; text-align:center;\" data-ad-layout=\"in-article\" data-ad-format=\"fluid\" data-ad-client=\"ca-pub-4376591297601343\" data-ad-slot=\"5387153895\"><\/ins>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script>\n\n\n\n<h2 class=\"wp-block-heading\">Add the Configuration for WHMCS in Your Default.conf file.<\/h2>\n\n\n\n<p>This tutorial is very simple and you only need to edit one file, <br><strong>default.conf<\/strong>. By default in nginx, this file is found in: <strong>\/etc\/nginx\/conf.d\/default.conf<\/strong><br><br>You can edit this file by running the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">nano \/etc\/nginx\/conf.d\/default.conf <\/pre>\n\n\n\n<p>Once you have opened your configuration file, proceed towards adding the following code to the file within the <strong>server<\/strong> paragraphs:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    # WHMCS CONFIG\n    # When WHMCS updates, make sure to get the newest configuration at https:\/\/hostup.org\/blog\/whmcs-friendly-urls-configuration-for-nginx\/\n\n    location ~ \/billing\/announcements\/?(.*)$ {\n        rewrite ^\/(.*)$ \/billing\/index.php?rp=\/announcements\/$1;\n    }\n\n    location ~ \/billing\/download\/?(.*)$ {\n        rewrite ^\/(.*)$ \/billing\/index.php?rp=\/download$1;\n    }\n\n    location ~ \/billing\/knowledgebase\/?(.*)$ {\n        rewrite ^\/(.*)$ \/billing\/index.php?rp=\/knowledgebase\/$1;\n    }\n\n    location ~ \/billing\/store\/ssl-certificates\/?(.*)$ {\n        rewrite ^\/(.*)$ \/billing\/index.php?rp=\/store\/ssl-certificates\/$1;\n    }\n\n    location ~ \/billing\/store\/sitelock\/?(.*)$ {\n        rewrite ^\/(.*)$ \/billing\/index.php?rp=\/store\/sitelock\/$1;\n    }\n\n    location ~ \/billing\/store\/website-builder\/?(.*)$ {\n        rewrite ^\/(.*)$ \/billing\/index.php?rp=\/store\/website-builder\/$1;\n    }\n\n    location ~ \/billing\/store\/order\/?(.*)$ {\n        rewrite ^\/(.*)$ \/billing\/index.php?rp=\/store\/order\/$1;\n    }\n\n    location ~ \/billing\/cart\/domain\/renew\/?(.*)$ {\n        rewrite ^\/(.*)$ \/billing\/index.php?rp=\/cart\/domain\/renew$1;\n    }\n\n    location ~ \/billing\/account\/paymentmethods\/?(.*)$ {\n        rewrite ^\/(.*)$ \/billing\/index.php?rp=\/account\/paymentmethods$1;\n    }\n\n    location ~ \/billing\/password\/reset\/?(.*)$ {\n        rewrite ^\/(.*)$ \/billing\/index.php?rp=\/password\/reset\/$1;\n    }\n\n    location ~ \/billing\/account\/security\/?(.*)$ {\n        rewrite ^\/(.*)$ \/billing\/index.php?rp=\/account\/security$1;\n    }\n\n    location ~ \/billing\/subscription?(.*)$ {\n        rewrite ^\/(.*)$ \/billing\/index.php?rp=\/subscription$1;\n    }\n\n#Social media authorization\n    location ~ \/billing\/auth\/provider\/google_signin\/finalize\/?(.*)$ {\n        rewrite ^\/(.*)$ \/billing\/index.php?rp=auth\/provider\/google_signin\/finalize$1;\n    }\n\n #WHMCS ADMIN\nlocation ~ \/billing\/admin\/(addons|apps|search|domains|help\\\/license|services|setup|utilities\\\/system\\\/php-compat)(.*) {\n        rewrite ^\/(.*)$ \/billing\/admin\/index.php?rp=\/admin\/$1$2 last; \n    }\n\n    location ~ \/billing\/admin\/client\/?(.*)\/paymethods\/?(.*)$ {\n        rewrite ^\/(.*)$ \/billing\/admin\/index.php?rp=\/client\/?(.*)\/paymethods\/$1;\n    }\n\n    location ~ \/billing\/admin\/setup\/auth\/?(.*)$ {\n        rewrite ^\/(.*)$ \/billing\/admin\/index.php?rp=\/setup\/auth\/$1;\n    }\n\n    location ~ \/billing\/admin\/client\/?(.*)\/tickets\/?(.*)$ {\n        rewrite ^\/(.*)$ \/billing\/admin\/index.php?rp=\/client\/?(.*)\/tickets\/$1;\n    }\n\n    location ~ \/billing\/admin\/client\/?(.*)\/invoice\/?(.*)\/capture\/?(.*)$ {\n        rewrite ^\/(.*)$ \/billing\/admin\/index.php?rp=\/client\/?(.*)\/invoice\/?(.*)\/capture\/$1;\n    }\n\n    location ~ \/billing\/admin\/account\/security\/two-factor\/?(.*)$ {\n        rewrite ^\/(.*)$ \/billing\/admin\/index.php?rp=\/admin\/account\/security\/two-factor\/$1;\n    }\n\n    location ~ \/billing\/admin\/search\/intellisearch?(.*)$ {\n        rewrite ^\/(.*)$ \/billing\/admin\/index.php?rp=\/search\/intellisearch\/$1;\n    }\n\n# Security Advisory 2020-01-28\n    location ^~ \/vendor\/ {\n        deny all;\n        return 403;\n    }\n# END WHMCS CONFIG<\/code><\/pre>\n\n\n\n<p> Save &amp; exit by pressing <bawt-key>CTRL<\/bawt-key> +  <bawt-key>X<\/bawt-key> followed by <bawt-key>Y<\/bawt-key> <\/p>\n\n\n\n<script async=\"\" src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\n<ins class=\"adsbygoogle\" style=\"display:block; text-align:center;\" data-ad-layout=\"in-article\" data-ad-format=\"fluid\" data-ad-client=\"ca-pub-4376591297601343\" data-ad-slot=\"5387153895\"><\/ins>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script>\n\n\n\n<h3 class=\"wp-block-heading\">Directory other than \/billing<\/h3>\n\n\n\n<p>Alternatively, if you are using <strong>another directory<\/strong>, then this code will not work. You will have to replace  &#8216;\/billing\/&#8217; with your directory.<\/p>\n\n\n\n<p>Here comes an example of this. Let&#8217;s say that we have our <strong>whmcs installed at another directory<\/strong>. For example, example.com\/account. You then need to replace all of the bits of code in a similar mattar<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>location ~ \/account\/announcements\/?(.*)$ {\n    rewrite ^\/(.*)$ \/account\/index.php?rp=\/announcements\/$1;\n}<\/code><\/pre>\n\n\n\n<p>If you are instead <strong>using a subdomain<\/strong>, billing.example.com you can simply remove the \/billing\/ as shown below<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>location ~ \/announcements\/?(.*)$ {\n    rewrite ^\/(.*)$ \/index.php?rp=\/announcements\/$1;\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Directory other than \/admin<\/h3>\n\n\n\n<p>If you have <a href=\"https:\/\/docs.whmcs.com\/Customising_the_Admin_Directory\" target=\"_blank\" rel=\"noopener\">customized your admin<\/a> directory &#8211; a security change that makes it harder for bots and other malicious users to find your login directory, then you need to make some changes to the above code.<\/p>\n\n\n\n<p>You need to replace <strong>\/admin\/<\/strong> with your <strong>\/customdirectory\/<\/strong>. You should follow this principle for all <strong>\/admin\/<\/strong> as shown below.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>location ~ \/billing\/customdirectory\/setup\/auth\/?(.*)$ {\n    rewrite ^\/(.*)$ \/billing\/customdirectory\/index.php?rp=\/setup\/auth\/$1;\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Hi there again! If you are like me and want to use the friendly URLs option with Nginx on WHMCS, but noticed that it does not work, then you have come to the right place. If you don&#8217;t already have a VPS, or want to reward us for hard work and ad free experience you [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":150,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-45","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/hostup.se\/en\/blog\/wp-json\/wp\/v2\/posts\/45","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hostup.se\/en\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hostup.se\/en\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hostup.se\/en\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hostup.se\/en\/blog\/wp-json\/wp\/v2\/comments?post=45"}],"version-history":[{"count":4,"href":"https:\/\/hostup.se\/en\/blog\/wp-json\/wp\/v2\/posts\/45\/revisions"}],"predecessor-version":[{"id":230,"href":"https:\/\/hostup.se\/en\/blog\/wp-json\/wp\/v2\/posts\/45\/revisions\/230"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hostup.se\/en\/blog\/wp-json\/wp\/v2\/media\/150"}],"wp:attachment":[{"href":"https:\/\/hostup.se\/en\/blog\/wp-json\/wp\/v2\/media?parent=45"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hostup.se\/en\/blog\/wp-json\/wp\/v2\/categories?post=45"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hostup.se\/en\/blog\/wp-json\/wp\/v2\/tags?post=45"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}