How to enable URL Rewriting - SapuSeven/picontrol GitHub Wiki
Enabling URL Rewriting will .
Edit the configuration file by executing nano /var/www/html/config.php
.
In the opened file, set $rewriting
to true
. Save and quit.
Now, execute a2enmod rewrite
and nano /etc/apache2/sites-available/000-default.conf
.
Search for AllowOverride
and set it to All
for the entry with DocumentRoot /var/www/html/
.
Again, save and quit.
The last step is nano /var/www/html/.htaccess
(If you have PiControl installed in a subdirectory on your server, you may need to change the root path according to your own needs). Type in the following:
RewriteEngine On
RewriteRule ^details$ index.php?page=details
RewriteRule ^services$ index.php?page=services
RewriteRule ^disks$ index.php?page=disks
RewriteRule ^gpio$ index.php?page=gpio
RewriteRule ^logout$ login.php?logout
Save and quit for the last time.
Finally, restart your server using sudo a2enmod rewrite && sudo service apache2 restart
.