This is my URL
mysite.com/somename
I want to assign somename to a php variable and I don't want to use any get method
You can achive with htaccess
something like this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^(.*) index.php?name=$1
</IfModule>
$name = $_GET['name'];
echo $name;
try
$somename = substr($url, stripos($url,'/') + 1)
Maybe $_SERVER['PATH_INFO']
would work for you? $_SERVER doc.
Please check this out:
$datum = parse_url($_SERVER['REQUEST_URI']);
$url_detail = pathinfo($datum['path']);
print_R($url_detail);