php - Trying to get Product Name and product ID into url with slash at the end and in between without ?p= -
I think the title says almost all.
My original URL looks like this: http: //www.something.com/buy/index.php?p=225823
.htaccess I Using the looks like this:
Option + follow link rewrite on the rewrite of the engine% {REQUEST_FILENAME}! -f Rewrite Convert% {REQUEST_FILENAME}! -d RectitRule ^ (\ d +) * $ ./index.php?p=$1
resulting in the url: http://www.something.com / Buy / 025823
I would like to end with a URL: http: //www.something.com/buy/Product name / 025823 /
Can anyone help? Especially a Gumbau Fellow! If you can control the links on your / buy /
-
option for the spaces Are). Then revise your rewrite regex to ignore the product name part of your URL. Revoirebase / Rev. Raul ^ / buy / (. +) / (\ D +) / $ ./index.php?p = $ 2
If you can not control the link, then things get more complicated because you have to look at the product name using the RewriteMap
and then have a demonstration that I've covered it recently. . My statement goes into more detail about using the RewriteMap
, but I do not think the details of this answer apply to your situation because using a consistently defined list of products Needs will not be met.
In fact, you will need to execute a script which can be said by the mod_rewrite's RewriteMap
rule, something you'll need:
< Code> renewal prodname pgm: /path/to/script/namelookup.shRewriteRule ^ / buy / (\ d +) / $ / buy / $ {prodname: $ 1} / $ 1 / [r = permanent]
Where nimilukupa (or whatever) returns the name of the product (at the standout) in the url-encoded format. You definitely want to see about using the RewriteMap
, especially the external section of the RewriteMap Directive
about using the external restructuring program.
Comments
Post a Comment