I've written the next code during my .htaccess file

Options +FollowSymLinks
RewriteEngine on
RewriteRule page/(.*)/ index.php?page=$1&%{QUERY_STRING}
RewriteRule page/(.*) index.php?page=$1&%{QUERY_STRING}

The url "abc.in/index.php?page=home" may be like this within the address bar of browser "abc.in/page/home"

If I wish to pass a flexible through URL than I will need to write as "abc.in/page/home?value=1" or "abc.in/page/home?value=1&value2=56&flag=true"

The first a part of url (abc.in/page/home) is clean(internet search engine friendly), but when I pass more variables within the url it does not look good.

I wish to get this to url like "abc.in/page/home/value/4/value2/56" and so forth.

The variables value and value2 aren't static they're used just for instance right here. Title could be anything.

Can you really do that ?

Help me make up the ".htaccess" file

(any corrections associated with title or language or tags utilized in this are welcome)


The simplest is always to parse the URL path with PHP. You would then only need this rule to rewrite the demands for your PHP file:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule !^index\.php$ index.php [L]

The problem will make sure that only demands to non-existing files are rewritten.

Your PHP script could than seem like this:

$segments = explode('/', ltrim($_SERVER['REQUEST_URI_PATH']));
for ($i=0, $n=count($segments); $i<$n; $i+=2) {
    $_GET[rawurldecode($segments[$i])] = rawurldecode($segments[$i+1]);