I am learning about url rewriting on .htaccess and is there any good book where i can learn.
I building an RESTfull webservices and i am working with pretty urls
Now I wrote below syntax in .htaccess file to achieve other urls.
RewriteRule ([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/users/([0-9a-zA-Z]) users.php?key=$1&format=$2&uid=$3
RewriteRule ([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/users users.php?key=$1&format=$2
Example 1
And url i tried and result are mentioned below
e.g. http://localhost/site/key/format/users/user_id
http://localhost/rest/r123/json/users/pGQqAMbVQAFx
test.php
<?php print_r($_GET); ?>
And only get values for key
and format
not uid
and value for key
is php
and i dont know how php value comes into exists
output.
Array
(
[key] => php
[format] => json
)
Example 2
http://localhost/rest/r123/json/users/
output
Array
(
[key] => r123
[format] => json
)
And is there any good book on url rewriting for beginners other than apache documentation.