PHP Programing

.htaccess RewriteRule Examples

Here are some examples of rewriteRules that i found online, I am always looking for this, so I decided to save them here. Thanks to brontobytes for the examples. Example 1 Original URL:http://www.domain.com/product.php?id=15 Rewritten URL:http://www.domain.com/15.php Rule for .htaccess:RewriteEngine OnRewriteRule ^([^/]*)\.php$ /product.php?id=$1 [L] Example 2 Original URL:http://www.domain.com/product.php?id=15 Rewritten URL:http://www.domain.com/product15.php Rule for .htaccess:RewriteEngine OnRewriteRule ^product([^/]*)\.php$ /product.php?id=$1 [L]… read more »

Nextcloud 18.0.1 with Docker-compose

Today I got my nextcloud server running with docker compose. Here is a run down of what I had to figure out: I had to chose how to install it, went with what is in the github repo: https://github.com/nextcloud/docker.git I chose the with-nginx-proxy with apache: https://github.com/nextcloud/docker/tree/master/.examples/docker-compose/with-nginx-proxy/mariadb/apache. The nginx proxy is a must if you are… read more »

Configure Server to return the Cache-Control response

This setting tells the browser how long to keep a copy of the website and use it, instead of getting it from the server. This will reduce the website load time, and makes for a better user experience. Options that come with Cache-Control:no-cache: tells the browser to check if the resource has changed, if so… read more »

Special characters in PHP / MySQL

Quick and easy fix for when you code displays weird characters ??? instead of displaying the right characters: <?php mysqli_query($conn, “SET character_set_results = ‘utf8’, character_set_client = ‘utf8’, character_set_connection = ‘utf8’, character_set_database = ‘utf8’, character_set_server = ‘utf8′”); ?> I place this right after my database connection to make sure every character is displayed correctly. I also place… read more »

Sidebar