url pass multiple variables on .htaccess

 In this post I want to explain about URLs rewriting techniques using .htaccess file. Friendly URLs looks neat on the browser address bar.



RewriteRule extraurl/(.*).html currentsite.php?id=$1 [L,QSA]

RewriteRule ^extraurl/(.*).html subayurveda.php?aid=$1 [L,QSA]

url pass multiple variable
 url pass multiple variables on .htaccess


RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)$ index.php?keys=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ index.php?keys=$1


<?php

$keys=$_GET['keys'];

if($keys=='home')
{
include('home.php'); // Home page
}
else if($keys=='login')
{
include('login.php'); // Login page
else if($keys=='terms')
{
include('terms.php'); // Terms page
}
else 
{
include('users.php'); // Users Gateway
}
?>

Multipul Value:

htaccess code:

RewriteRule ^([\da-z]+)/([\da-z]+)/(\d+)/?$ index.php?category=$2&language=$1&id=$3 [L,QSA,NC]
RewriteRule ^([\da-z]+)/([\da-z]+)/?$ index.php?category=$2&language=$1 [L,QSA,NC]

php code:

print($_REQUEST);
exit;

output:

category = Value and Language = Value and id






url pass multiple variables on .htaccess Dev2Tricks 5 of 5
 In this post I want to explain about URLs rewriting techniques using .htaccess file. Friendly URLs looks neat on the browser address bar. ...

Share this

Related Posts

Previous
Next Post »

Xolo Offer