Hi everybody I have a link such as : www.mysite.com/product.php?id=123 and another link as : www.mysite.com/details.php?id=123 the product name of the code 123 is (for example) : PRD1 I want to change my Links to : www.mysite.com/PRD1/ instead of www.mysite.com/product.php?id=123 and for 2nd link use this one: www.mysite.com/PRD1/details/ instead of www.mysite.com/details.php?id=123 How to do this with .htaccess file? is it possible?
No expert but yes its possible. You will need to look up regex. (regular expression) Here is something real quick it prolly won't work but you can try it RewriteRule ^(.*)$\/ product.php?id=$1 RewriteRule ^(.*)$\/details\/ details.php?id=$1 ^ is the start, ex: after the trailing slash in the url, http://site.com/ (.*)$ should be everything between the trailing slash and the next slash. \/ is an escaped slash that should be in the url. Hopefully this helps you a bit, and maybe someone else who knows regex will jump in! hehe
Thank u Now if I want to use a string id such as (id=7cd3g002) , what should to do? may I use the same code? like this:
Hi I want to manipulate html file using .htaccess By the way the error message from the ApACHE log file is [Sun Jun 24 17:18:14 2007] [error] [client 127.0.0.1] Filename is not valid: d:/easyphp1-8/www/zen-cart-v1.3.7-full-fileset-12302006/piggy-guest-book-p- 234:2bfedfbc8c496a2b3f98e69e988d177e.html So anyone has any idea how to remove the random numbers and letters after the colon) sign? Colon ) sign should also be removed. How to do it using .htaccess?