I believe you’re trying to create URL’s friendly, all right, buddy?
For this, you can create a file .htaccess
and configure it so that the text after the bar is interpreted as a parameter GET
, then to receive it in PHP you normally use the $_GET
(in the case $_GET['nick']
), as if the url were indeed ?nick=nickuser
.
Would look like this:
.htaccess
RewriteEngine On
#Reescrita de URL
#Na linha abaixo será definido que o parâmetro nick poderá receber letras e números
RewriteRule ^([a-zA-Z0-9_-]+)$ profile.php?nick=$1
Already in the php file, you would receive normal:
PHP
<?php
echo $_GET['nick'];
?>
In case the url accessed is 'profile.php/testeName' or 'profile.php? nick=testeName' the result will be the display of:
testeNome
But as I get this value from the url that the user type in the browser, in your example you just broke a string/url q vc already have, in case I don’t know what the user type in the browser yet. And how I redirect to a php file that url ?
– Pertile
@Belong
profile.php
is a include or a redirect?– Papa Charlie