Website must have the URL, a webmaster when creating a website must have a different URL, meaning websites that sho page own name, there is also whow GET variables in URL, it is now here we are trying to condense fromURLs that include GET variables are, for example as below:
localhost/simplycdesign/index.php?m=product
actually, if you want to use a URL that does not berembel variabl GET-strings we canuse the framework Code Igniter (CI) in building the web, because CI already has itsown system in building websites. CI for the tutorial I will explain later.
okay, from the URL above image manipulation we will be:
okay, from the URL above image manipulation we will be:
localhost/simplycdesign/product/
obvious right? then the function of the URL on top of what?
very clear, the function to be manipulating URLs like the above are:
- Our URL is better known by google because there is no GET variables in our URL.
- Confidentiality and security of the web, meaning that our website is safe from thosewho access our website, because the url and the page we uda hidden.
ok, next. how the hell do I? I use localhost server to direct practice.
on my index.php page has a code like this:
on my index.php page has a code like this:
<?php
$mod=$_GET[m];
?>
<a href="index.php?m=product">Product</a>
<?php
if($mod=="product"){
echo "ini isi product";
}
?>
means when a user clicks on the word "product" then the page's URL will change to be like the first picture. to manipulate, we first have to set up the server, I use XAMPPis localhost.
Go to the directory on the server via explorer.
Go to the directory on the server via explorer.
C:\Program Files\xampp\apache\conf
There was a file called httpd.conf. Open the file use notepad, whose writings continue to look for the line
#LoadModule rewrite_module modules/mod_rewrite.so
Delete (#) in that row. become ..
LoadModule rewrite_module modules/mod_rewrite.so
Then, create a file. htaccess on our web directory which contents:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^/?([A-Za-z]+)/?$ index.php?m=$1 [L]
</IfModule>
Now, edit the existing script in the index.php into:
<?php
function singkat($kunci) {
$adr=$_SERVER['PHP_SELF'];
$alamat=explode("/",$adr);
$akhir=end($alamat);
$_RESULT=str_replace("$akhir","",$adr);
echo $_SERVER['HTTP_HOST'],$_RESULT,$kunci;}
$mod=$_GET[m];
?>
<a href="index.php?m=product"?>Product</a>
<?php
if($mod=="product"){ echo "ini isi product";
}
?>
Save then run in a browser. when we click the product then the URL will be:
to remember the product/ the shadow directory, so the index file as if it is in the product directory, so we need to change the links that exist within our website file for example:
localhost/simplycdesign/index.php?m=product
koneksi.php and index.php file and found in a directory of directories simplyddesign.then in index.php we must menguba include a link to ".. / koneksi.php". because as if the index file exists in the product directory.