I'm a pretty skilled programmer, however when it involves RegEx and spinning, I'm a total n00b. I wish to convert a URL from
where "item" refers back to the title of the item inside a database that's being looked-up.
I am using Light (Linux, Apache, MySQL, PHP) and that i cannot, for that existence of me, learn how to convert the Web addresses so that they are Search engine optimization friendly.
Simple .htaccess example:
<IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^lookup/([a-z0-9\-]+)/item/?$ /lookup.php?id=$1 </IfModule>
This can match any alphanumeric (will also recognise dashes) string associated with a length because the 'id'. You are able to limit this to simply number by altering the regex to
<IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^lookup/([a-z0-9\-]+)/([a-z0-9\-]+)/?$ /lookup.php?id=$1&view=$2 </IfModule>
That one will match
Would you like to redirect in the old Hyperlink to the brand new? Or are you currently searching to see in individuals "friendly" Web addresses after which ask them to become that old URL?
Whether it's the second, try considering Net_URL_Mapper in an effort to parse and redirect individuals links fairly easily.
Have a look on htaccess rewrite web addresses! :)
Here is your example:
RewriteRule ^lookup/(\d+)/(.*)$ /lookup.php?id=$1&name=$2
Whenever you access
lookup/123/my-product/, it'll call the
lookup.php?id=123&name=my-product file internally.