I get mysite.com/?file=abc
<?php if(!empty($_GET['file'])) {?>
<?php echo $_GET['file']; ?>
<?php } ?>
it's possible get value like this: mysite.com/file/abc
I get mysite.com/?file=abc
<?php if(!empty($_GET['file'])) {?>
<?php echo $_GET['file']; ?>
<?php } ?>
it's possible get value like this: mysite.com/file/abc
If you are using apache, and your config allows for htaccess overrides, you can create an .htaccess file like this
# Turn on URL rewriting
RewriteEngine On
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php?q=$1 [L]
URL
mysite.com/file/abc
In your php file do something like this
<?php
$query = explode('/', $_GET['q']);
if ($query[0] === 'file') {
echo $query[1];
}