Forum Moderators: phranque
mydomain.com/index.php
my main categories :
mydomain.com/list.php?pagenum=0&catid=2
to
mydomain.com/list.php?pagenum=0&catid=19
in the category 19 sample url
mydomain.com/fikra.php?id=701&listtype=4&catid=19
mydomain.com/fikra.php?id=696&listtype=4&catid=19
can anyone help me to find the correct Mod_rewrite codes.
Thanks
Welcome to WebmasterWorld!
This search [google.com] should turn up some good threads to get you started with rewriting static to dynamic URLs.
Useful references are cited in our forum charter [webmasterworld.com].
Jim
# REWRITING THE OTHERS
RewriteRule ^cat(.*).html$ list.php?pagenum=$1&catid=$1 [L]
RewriteRule ^viewfikra(.*).html$ fikra.php?id=$1&listtype=4&catid=$1 [L]
i have try this code,but my site give this error
Forbidden
You do not have permission to access this document.
--------------------------------------------------------------------------------
Web Server at domain.com
when i tr this code,i can find
[domain.com...] it work fine
but page numbers dont work now
[domain.com...] isn't show the true page
[domain.com...] isn't show the true page
and the other thing,when i am on index php or category-0-2.htm
my category list give the php urls like as :
list.php?pagenum=0&catid=2
what must i do for change them to
category-0-2.htm
category-0-3.htm
category-0-4.htm
......
# REWRITING THE OTHERS
RewriteRule ^category([^-]+)-([^-]+)\.htm$ /list.php?pagenum=$1&catid=$2 [L]
and the other thing, when i am on index php or category-0-2.htm
my category list give the php urls like as :
list.php?pagenum=0&catid=2
what must i do for change them to
category-0-2.htm
category-0-3.htm
category-0-4.htm
In this way, visitors and robots "see" the friendly URLs, "click" on them, and request a friendly URL from your site. You mod_rewrite rules them change that friendly URL back into a call to your "list.php" script, with the parameters moved from the URL into query string parameters.
Jim
The problem is a missing - that is being stored in the first variable:
RewriteRule category(.*)-(.*)\.htm$ /list.php?pagenum=$1&catid=$2
Correction:
RewriteRule category-(.*)-(.*)\.htm$ /list.php?pagenum=$1&catid=$2
Or this:
RewriteRule ^category-([^-]+)-([^-]+)\.htm$ /list.php?pagenum=$1&catid=$2 [L]
Think I have missed one of those myself once or twice...
Justin
Added: The bottom rule is faster =)
RewriteRule category-(.*)-(.*)\.htm$ /list.php?pagenum=$1&catid=$2 [L]
RewriteRule fikra-(.*)\.htm$ /fikra.php?id=$1 [L]
this codes are true,but what must i do for change the links in index.php
must i put any code to my php scritp? can anyone help me please