Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

user friendly url's with htaccess

$
0
0

Hi,

Can someone help me with User friendly URL and get variables.

 

My file is called test.php and i'm using htaccess to remove the .php part of the url.

 

In theory i want the following:
www.example.com/test/1234

 

1234 is my id= part

 

How can i do this?

here's my htaccess so 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 to get the get variable by:


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

 


Viewing all articles
Browse latest Browse all 13200

Trending Articles