url rewriting - php url friendly withhtaccess and get variables -


can me user friendly url , variables.

my file called test.php , i'm using htaccess remove .php part of url. in theory want following url construction in following format: www.example.com/test/1234

where 1234 id= part

whats best way , how can this?

here's htaccess far:

options -indexes  rewriteengine  on rewritecond %{request_filename}.php -f rewriterule !.*\.php$ %{request_filename}.php [l, qsa]  rewriterule ^(.*)$ test.php?/$1 [l] 

i'm trying get variable by:

$var = $_get['id'];  echo $var; 

any appreciated. in future using pass products name , using them variables increase seo , user experience. if need more information or questions im happy respond

can see if works?

rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewritecond %{request_filename} !-l   rewriterule ^test/(.+)$ test.php?id=$1 [qsa,l] 

^ above works


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -