Skip to content

Demo Path Rewrite

TandelK edited this page Dec 12, 2019 · 4 revisions

Basically most of the Website have Unlimited Bandwidth , Unlimited Space on their Web Hosting packages but limited on VPS which might have limited Data Transfer and Space for each instance on which Get5-Web might be hosted. Here is a Simple Rewrite Script added in .htaccess for redirecting Demos location from Get5-Web to other website.

There are 2 possible ways to host the demos.

  1. As a subfolder [example.com/csgodemos/]
  2. As a subdomain [csgodemos.example.com]

Just make sure that you configure FTP connections to this website properly. If you have cPanel access, you already get FTP Manager where you can create special new Username and Passwords and assign website to them or even Subfolder.

In Get5_api.cfg please configure the Demo Upload FTP function properly so the demos goes correctly to the new URL.

Both of the above URL are valid in our Rewrite Condition we are making below.

As we already know we are using Apache2 in our VPS for using with our Get5-Web panel, we are going to first enable Apache2 Rewrite module which helps us in Rewrite URLs in so many ways. Apache2 Official Guide on mod_rewrite

Make sure to change Apache configuration file located in /etc/apache2/apache2.confand modify the line number 166 [different if file is modified before] saying

Change the AllowOverride from none to all

<Directory /var/www/>

Options Indexes FollowSymLinks

AllowOverride all

Require all granted

</Directory>

Go to main folder of Get5-Web installation folder. If you have used Script it is located in /var/www/get5-web

  1. Enable Rewrite Module of apache2 if not enabled

a2enmod rewrite

service apache2 restart

  1. Going to Main Directory of Get5-Web Installation directory.

cd /var/www/get5-web

  1. Create a new file called .htaccess

nano .htaccess

  1. Add the following lines to the file and change the last line to the Web URL of the Demo Location path. For eg. here we have https://example.com/csgodemos/

Options +FollowSymLinks

RewriteEngine On

RedirectMatch ^/static/demos/(.*)$ https://example.com/csgodemos/$1

Make sure to copy the last path after your domain /$1 part otherwise the path of demo wont work properly.

Clone this wiki locally