Question about rewrite rule,anybody who can help me?

Discuss practical ways rearrange URLs using mod_rewrite.

Question about rewrite rule,anybody who can help me?

Postby thistiny » Wed Nov 05, 2008 2:43 am

such as :

/Chinese-medicine-prescription_126/
TO:vkercms/plus/list.php?tid=126


/Chinese-medicine-prescription_126/126-2.html
TO:vkercms/plus/list.php?typeid=126&pageno=2


/TCM-medicinal-liquor_128/Wood-and-the-disease-polio-wine--himself-_65719.html
TO:vkercms/plus/view.php?aid=65719


how to write the rewrite rule?

i write it like this ,but doesn't work
#for article
RewriteRule ^[^\/]*/[^\d]*_([0-9]+)\.html$ vkercms/plus/view.php?aid=$1 [L]

#for list
RewriteRule ^.*?([0-9]+)?/?$ vkercms/plus/list.php?tid=$1 [L]
RewriteRule ^.*?/([0-9]+)?-([0-9]+)?.html$ vkercms/plus/list.php?typeid=$1&pageno=$2 [L]


anybody who can help me?
thistiny
 
Posts: 1
Joined: Wed Nov 05, 2008 2:37 am

Postby richardk » Wed Nov 05, 2008 1:50 pm

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^[^/]+_([0-9]+)/?$                     /vkercms/plus/list.php?tid=$1              [QSA,L]
RewriteRule ^[^/]+_([0-9]+)/[0-9]+_([0-9]+)\.html$ /vkercms/plus/list.php?typeid=$1&pageno=$2 [QSA,L]
RewriteRule ^[^/]+_[0-9]+/[^/]+_([0-9]+)\.html$    /vkercms/plus/view.php?aid=$1              [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 1 guest

cron