Forum Moderators: phranque
when i call a url from my site like
http://www.example.com/find/computer.php?limit=10&id=4
i am getting the results.
i want to use it more seo friendly so i use a code in my .htaccess file
Options +FollowSymLinks
RewriteEngine on
RewriteRule find/limit/(.*)/id/(.*)/ computer.php?limit=$1&id=$2
but it giving me some different result. The more important thing is i am not able to get my 'id' when i put echo $id; it giving me blank.
i like to use a url like
http://www.example.com/find/limit/10/id/4/
where limit=10 and id=4
please help.
i have applied the code still i am getting same problem.
one thing if i check the id value from my page after static url request then it will be easy for me to fix the bug
can you please help me to tell the way i can print the id in my page to see.
what i want when call url http://www.example.com/find/limit/10/id/4/
i want print id as 4 in my pages.
hope i can clear up.
again thanks for your reply.
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*)\.htm$ extra.php?title=$1
RewriteRule category/(.*)/ computer.php?cat_id=$1
RewriteRule ^category/([^/]+)/limit/([^/]+)/?$ /category.php?cat_id=$1&limit=$2 [L]
i want Four issue to be solved.
1)i have 2 other pages as html page when i am calling those html file goes to extra.php what i want to exclude those html file like china.htm.
2) when i call http://example.net/3/ the result is ok.
the page get category as 3 and display result properly.
3) But when i call http://example.com/3/10/ where limit is 10 basically a long page, it expect not getting category and limit properly.displaying error of not getting cat_id and limit.
please help
thanks.
Are your rules incorrect, or did you test a different URL from what you posted?
Note that your rules are not in the right order, since your rule #2 will match anything that might match rules #3. This might be part of the problem. I would re-arrange them like this:
Options +FollowSymLinks
RewriteEngine on
#
RewriteCond %{REQUEST_URI} !^/china\.htm$
RewriteRule ^([^.]+)\.htm$ /extra.php?title=$1 [L]
#
RewriteRule ^category/([^/]+)/limit/([^/]+)/?$ /category.php?cat_id=$1&limit=$2 [L]
#
RewriteRule ^category/([^/]+)/?$ /computer.php?cat_id=$1 [L]
this code is working for me perfectly and giving me to print my cat id and limit perfectly.
Thanks for your help. i really appreciate it.
One more thing i want to tell search engine or redirect url caller to move to my new url.
example,
http://example.net/computer.php?cat_id=3
http://example.net/computer.php?cat_id=2&limit=10
move to
http://example.net/category/3/
http://example.com/category/3/limit/10/
i like to know does the below mentioned code solve my purpose? also can i replace the /category/ portion
like http://example.net/3/ or http://example.com/3/limit/10/
is this code is able to replace my search engine ranking for the page http://example.net/computer.php?cat_id=3 to
new url http://example.net/category/3/ as i use R=301?
so i modified my code like.
Options +FollowSymLinks
RewriteEngine on
#
RewriteCond %{REQUEST_URI}!^/china\.htm$
RewriteRule ^([^.]+)\.htm$ /extra.php?title=$1 [L]
#
RewriteRule ^category/([^/]+)/limit/([^/]+)/?$ /computer.php?cat_id=$1&limit=$2 [R=301,L]
#
RewriteRule ^category/([^/]+)/?$ /computer.php?cat_id=$1 [R=301,L]
please help
Thanks for the help
This post [webmasterworld.com] should serve to explain how to do what you want, and to get you started coding the solution for yourself.
For aditional information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].
Jim