It seems I can finally no longer avoid the use of apache rewrite rules lol. So just trying to learn about them.
Im trying to create seo friendly urls.
This is what I have so far. The rewriteCond is wrong though I think:
Rew开发者_开发问答riteCond %{REQUEST_URI} results/(.*)/(.*)/([0-9]*)/(.*)/([0-9]*)/$
RewriteRule ^results/(.*)/(.*)/([0-9]*)/(.*)/([0-9]*)/$ results.php?p1=$1&p2=$2&p3=$3&p4=$4&p5=$5 [L]
When I go to the url: http://www.something.co.uk/results/foo/01-01-2011/1234/01-01-2011/1234 it actually works and posts all the GET values correctly. However my issue is when I submit the values to results.php from another page they always show the old school way with the ?=foo&01-01-2011..etc in steand of the /results/foo/...etc
Now from what I have read the rewriteCond is meant to take care of this. However im not sure what im doing wrong and why it is not redirecting to to the new version.
Any help, guidance, examples would be appreciated
Thanks
p.s if you see anything in the above that is bad practise or anything seriously flawed please do also comment. As I say im still learning :)
Your rewrite condition isn't needed - that's what the first part of the rule is for, matching a pattern.
RewriteRule ^results/(.*)/(.*)/([0-9]*)/(.*)/([0-9]*)/$ results.php?p1=$1&p2=$2&p3=$3&p4=$4&p5=$5 [L]
It sounds like you're also expecting the rewrite rule or condition to update URLs the system outputs. All they do is intercept requests that match their parameters and redirect them internally. So if you visit results.php, the URL won't be changed and you'll see the, as you say, old-school URL.
精彩评论