Forum Moderators: phranque
Given an URL, such as
example.com/see-spot-run-widgets-for-sale Can I rewrite that to:
file.php?widget=see spot run&action=sell The following is close, but it passes the hyphens:
RewriteRule ^([A-Za-z0-9-]+)-widgets-for-sale$ /file.php?widget=$1&action=sell[L] I need to strip out the hyphens, but I'm not sure that it can be done. The number of hyphens will vary (from none to perhaps 5).
Any suggestions greatly appreciated...
Jim
The client will be linking up the correct, hyphenated URLs, what I need to do is transparently pass the spaced out values to the system, So I could brute forece out the hypens for spaces... (No 301's necessary in our case).
What I may do is see if they can simply learn to handle the hyphenated GET.
As to "opposite" functions, that's easily solved by reversing/modifying the patterns and substitutions in the example rules (this is a do-it-yourself type of forum). :)
Jim
As to "opposite" functions...
Oh I know, I wasn't sure I explained myself well as you said "may help to focus your question", which tells me that you thought my question was outtawhack :)
For me, it's pretty clear that they should handle this in the script; lets hope they feel the same way (they already have a nice collection of rewrites running, keeping the number lower would be better).