{"id":1031,"date":"2024-12-31T15:11:53","date_gmt":"2024-12-31T07:11:53","guid":{"rendered":"https:\/\/www.6ebook.com\/?p=1031"},"modified":"2025-01-27T10:39:13","modified_gmt":"2025-01-27T02:39:13","slug":"polr","status":"publish","type":"post","link":"https:\/\/www.6ebook.com\/en\/polr\/","title":{"rendered":"Using Polr to build a short URL generation platform"},"content":{"rendered":"<p>For a long time, I've been using Jingdong Alliance\/Jingdao Fan to recommend books and other kinds of goodies on the Jingdong platform, mainly to introduce and share the experience of such goods, and to get the promotional links or QR codes of the goods, so as to make it convenient for users in need to go to check out and buy.<\/p>\n\n\n\n<p>And one of the biggest problems here is that both the shared link and the QR code have an expiration date of 60 days. After this expiration date, opening is to the Jingdong home page. I also consulted the official customer service on this issue and was told that this is how the platform is set up and there is no better way.<\/p>\n\n\n\n<p>But also got a useful piece of information, that is, in the Jingdong affiliate platform, you can generate a long link to the goods, and the long link will not expire. So I added a custom field to each recommended article in the article publishing backend of my website, i.e.: Jingdong product link. At the same time, in the front-end page, display the link button, and through qrcode.js to generate the link QR code, so that users can scan the code directly to open the mobile Jingdong, directly to the product page.<\/p>\n\n\n\n<p>And this in turn creates a problem: due to the Jingdong Affiliate provides goods long link has more parameters (involving tracking the user to place an order as well as rebate calculation, etc.), resulting in the generation of QR code actually can not be used. The first time I also thought of using a short link generation platform.<\/p>\n\n\n\n<p>If you want to use the long link of Jingdong affiliate in each article of product recommendation, you can automatically convert it into short link by short link generation platform, and then generate QR code and link button in the article page. This is a semi-automated process that requires the use of an API, and third-party short link generation platforms are still limited.<\/p>\n\n\n\n<p>Then build a short connection generation platform! Search the web and find a suitable open source program: Polr<\/p>\n\n\n\n<div class=\"wp-block-essential-blocks-advanced-heading root-eb-advance-heading-gp35w\"><div class=\"eb-parent-wrapper eb-parent-eb-advance-heading-gp35w\"><div class=\"eb-advance-heading-wrapper eb-advance-heading-gp35w preset-1 undefined\" data-id=\"eb-advance-heading-gp35w\"><h2 class=\"eb-ah-title\"><span class=\"first-title\">What is Polr?<\/span><\/h2><p class=\"eb-ah-subtitle\"><strong>Polr<\/strong>\u00a0is a powerful, lightweight and open source short link management system for creating and managing short links. As an open source tool, Polr allows users to freely deploy and customize it, completely free from the limitations of paid services, making it ideal for individual users, small and medium-sized businesses, or teams of developers.<\/p><div class=\"eb-ah-separator line\"><\/div><\/div><\/div><\/div>\n\n\n\n<p>Polr has a lot of nice features, and for my needs, the following are very relevant:<\/p>\n\n\n\n<div class=\"wp-block-essential-blocks-feature-list  root-eb-feature-list-6utou\"><div class=\"eb-parent-wrapper eb-parent-eb-feature-list-6utou\"><div class=\"eb-feature-list-6utou eb-feature-list-wrapper eb-icon-position-left eb-tablet-icon-position-left eb-mobile-icon-position-left eb-feature-list-left\"><ul class=\"eb-feature-list-items circle stacked\"><li class=\"eb-feature-list-item\" data-new-tab=\"false\" data-icon-type=\"icon\" data-icon=\"fas fa-link\" data-icon-color=\"\" data-link=\"\"><div class=\"eb-feature-list-icon-box\"><div class=\"eb-feature-list-icon-inner\"><span class=\"eb-feature-list-icon\" style=\"color:\"><i icon=\"fas fa-link\" class=\"fas fa-link\"><\/i><\/span><\/div><\/div><div class=\"eb-feature-list-content-box\"><h3 class=\"eb-feature-list-title\">Randomized &amp; Customized Short Link Generation<\/h3><p class=\"eb-feature-list-content\">Support to generate random short links, also can be customized according to the needs of the link suffix.<\/p><\/div><\/li><li class=\"eb-feature-list-item\" data-new-tab=\"false\" data-icon-type=\"icon\" data-icon=\"fas fa-user-gear\" data-icon-color=\"\" data-link=\"\"><div class=\"eb-feature-list-icon-box\"><div class=\"eb-feature-list-icon-inner\"><span class=\"eb-feature-list-icon\" style=\"color:\"><i icon=\"fas fa-user-gear\" class=\"fas fa-user-gear\"><\/i><\/span><\/div><\/div><div class=\"eb-feature-list-content-box\"><h3 class=\"eb-feature-list-title\">Powerful management features<\/h3><p class=\"eb-feature-list-content\">Provides complete control over short links, including enabling\/disabling, deleting and other operations.\nEasily manage user rights (if multi-user mode is enabled).<\/p><\/div><\/li><li class=\"eb-feature-list-item\" data-new-tab=\"false\" data-icon-type=\"icon\" data-icon=\"dashicons-rest-api\" data-icon-color=\"\" data-link=\"\"><div class=\"eb-feature-list-icon-box\"><div class=\"eb-feature-list-icon-inner\"><span class=\"eb-feature-list-icon\" style=\"color:\"><span class=\"dashicon dashicons dashicons-rest-api\"><\/span><\/span><\/div><\/div><div class=\"eb-feature-list-content-box\"><h3 class=\"eb-feature-list-title\">API Integration<\/h3><p class=\"eb-feature-list-content\">Provides a RESTful API for developers to integrate Polr into other applications or automated processes.<\/p><\/div><\/li><\/ul><\/div><\/div><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" style=\"font-size:1.5em\"><strong>Installation Configuration<\/strong><\/h2>\n\n\n\n<p>1, installed the web environment of a server, you can use lnmp, lamp one-click package or pagoda and other panels to build the web environment.<br>2, a nice short enough domain name with good resolution.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" style=\"font-size:1.2em\"><strong>preliminary<\/strong><\/h3>\n\n\n\n<p><strong>Github address:<\/strong>https:\/\/github.com\/cydrobolt\/polr<\/p>\n\n\n\n<p style=\"font-size:1em\">1. Add website and download program<\/p>\n\n\n\n<p>Add the domain name and go to the root directory of the website and use the following command.<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\" data-no-auto-translation=\"\"><code class=\"language-powershell\">cd \/www\/wwwroot\/website.com\n#\u4e0b\u8f7d\u5b98\u65b9\u6e90\u7801\ngit clone https:\/\/github.com\/cydrobolt\/polr.git\nmv polr\/{.,}* .\/\n\n#\u4e0b\u8f7d\u6c49\u5316\u6587\u4ef6\uff08\u7f51\u4e0a\u6d41\u4f20\u7684\u6c49\u5316\u7248\u672c\uff0c\u65e0\u6cd5\u652f\u6301\u4e8c\u7ef4\u7801\u529f\u80fd\uff0c\u6b64\u5904\u535a\u4e3b\u4f9d\u636e\u6700\u65b0\u7248 Polr \u81ea\u884c\u6c49\u5316\u4e86\u4e00\u4e2a\uff0c\u529f\u80fd\u6b63\u5e38\u4f7f\u7528\u3002\uff09\ncd resources &amp;&amp; rm -rf views &amp;&amp; wget https:\/\/github.com\/honorcnboy\/Porl-CHN\/releases\/download\/1.0.0\/porl_views_1.0.tar.gz\ntar zxvf porl_views_1.0.tar.gz\ncd ..<\/code><\/pre>\n\n\n\n<p>2. Download and install composer<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\" data-no-auto-translation=\"\"><code class=\"language-powershell\">#\u5728\/root\u76ee\u5f55\u4e0b\u5b89\u88c5Composer\ncurl -sS https:\/\/getcomposer.org\/installer | php\nmv composer.phar \/usr\/local\/bin\/composer\n\n#\u8fdb\u5165\u7f51\u7ad9\u6839\u76ee\u5f55\u8fd0\u884c\ncd \/www\/wwwroot\/website.com\ncomposer install --no-dev -o<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>3. Will <code>.env.setup<\/code> Create a file named <code>.env<\/code> duplicate<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\" data-no-auto-translation=\"\"><code class=\"language-\">cp .env.setup .env<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>4. Website setup<\/p>\n\n\n\n<p>Click on Website - Settings - Pseudo Static in the Pagoda panel and set it to:<code>laravel5<\/code>Then go to Web Directory - Running Directory and select Then go to Web Directory - Runtime Directory and select<code>\/public<\/code>and save it. Then go back to Pseudostatic and fill in the following code. At the same time, set up the SSL<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\" data-no-auto-translation=\"\"><code class=\"language-apacheconf\"># Ngnix\nlocation \/ {\n            try_files $uri $uri\/ \/index.php$is_args$args;\n}\n\n# Apache\n&lt;IfModule mod_rewrite.c&gt;\n    &lt;IfModule mod_negotiation.c&gt;\n        Options -MultiViews\n    &lt;\/IfModule&gt;\n\n    RewriteEngine On\n\n    # Redirect Trailing Slashes...\n    RewriteRule ^(.*)\/$ \/$1 [L,R=301]\n\n    # Handle Front Controller...\n    RewriteCond %{REQUEST_FILENAME} !-d\n    RewriteCond %{REQUEST_FILENAME} !-f\n    RewriteRule ^ index.php [L]\n&lt;\/IfModule&gt;<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>5. Reboot <code>Nginx<\/code> \/ Apache, change the permissions of all files under the site to 777, owner www<\/p>\n\n\n\n<p>6. Go to http:\/\/website.com\/setup to complete the settings<\/p>\n\n\n<p>[wshop_reward]<\/p>","protected":false},"excerpt":{"rendered":"<p>Polr is a powerful open-source link shortening tool that supports custom link generation, QR codes, detailed access statistics, and RESTful API integration, suitable for both individual and enterprise users. This article details Polr&#039;s features, deployment methods, and application scenarios to help users easily get started with this open-source project.<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_eb_attr":"","footnotes":""},"categories":[1],"tags":[21],"class_list":["post-1031","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-open-source"],"acpt":{"meta":[]},"_links":{"self":[{"href":"https:\/\/www.6ebook.com\/en\/wp-json\/wp\/v2\/posts\/1031","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.6ebook.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.6ebook.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.6ebook.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.6ebook.com\/en\/wp-json\/wp\/v2\/comments?post=1031"}],"version-history":[{"count":0,"href":"https:\/\/www.6ebook.com\/en\/wp-json\/wp\/v2\/posts\/1031\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.6ebook.com\/en\/wp-json\/wp\/v2\/media?parent=1031"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.6ebook.com\/en\/wp-json\/wp\/v2\/categories?post=1031"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.6ebook.com\/en\/wp-json\/wp\/v2\/tags?post=1031"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}