Forum Moderators: phranque
For example:
rewriteRule ph\/([a-z-]+)\.php http:\/\/localhost\/ph\/detail\.php?var=$1 [L]
so that a var of "wordone" would be found as too would:
"wordone-wordtwo" or even a three dash set of words
Easy enough to mess with the var once you get it with ereg_replace but what about getting it.
Any chance of some pointers in these, something I will have to do more and more and I need to get a good understanding of it.
Cheers
moving to an "_" things work some of the time. For example using the below regex works.
ph\/([a-z_]+)\/ http:\/\/localhost\/ph\/detail\.php?var=$1 [L]
But if I try to get the file to look like
ph/word1_word2.php is does not, it hangs whenb using:
ph\/([a-z_]+)\.php http:\/\/localhost\/ph\/detail\.php?var=$1 [L]
Where am I going wrong.
Cheers
This might work a little better, if not perfectly:
RewriteCond (REQUEST_URI) !^/ph/detail
RewriteRule ^ph/(([a-z]+)(\-[a-z]+)*)\.php$ /ph/detail\.php?var=$1 [L]
The RewriteCond prevents an infinite loop if any subrequests or external redirects are done.
Jim
file-name/
it works well.
Can I ask why the need for the first bit that you used.
My errot logs just shows a "file does not exist" message.
It feels close :)
RewriteCond (REQUEST_URI)!^/ph/detail
I'm afraid I can't tell if the rest is working for you or not, UK and Texas idioms being different and all...
Jim