JUST Chillax
JUST Chillax

Reputation: 45

How to get username from url on index page

i want to get username on index page, for example if url is https://bonusbits.cf/any_name i want to get "any_name" and show his status. but whenever i tried it shows error "The requested URL was not found on this server".

Upvotes: 0

Views: 131

Answers (1)

a.prakash
a.prakash

Reputation: 151

Can you try this

.htaccess file

# Not for real file or directory
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

then in the PHP file

 $link = $_SERVER['PHP_SELF'];
 $path = explode('/',$link);
 echo $name = end($path);

Upvotes: 1

Related Questions