Reputation: 28074
So i already have some rewrites in place, but in truth i didn't write them :( i'd love to understand them rather than just asking for help. But i know nothing about them and i don't feel i have time spending hours learning :(
Anyway i'd like to turn
http://wouldyourathers.co.uk/?qid=1231
into:
http://wouldyourathers.co.uk/question/1231
For me qid is rather ugly. Lets just say i could easily change this to ?question but i still feel its not pretty.
Only problem is i already have rewrites in place with:
RewriteCond %{REQUEST_URI} !dispatch\.php$
RewriteCond /var/www/wyr/docroot%{REQUEST_FILENAME} !-f
RewriteRule ^(/.*)$ /dispatch.php?url=$1 [L,QSA]
RewriteRule ^x\.!dispatch\.php([^b]+)!dispatch\.php$ !dispatch\.php [L,NE]
This will point any request from my server to my dispatch.php and in here i basically mess around with the url's to display them in a sexy way. But i'm stumped as to how i can edit the query. Once inside the dispatch file i can edit this and do the code i need to effect the data calls.
Thanks (even if this is longer than needs be)
Upvotes: 1
Views: 706
Reputation: 17
Right now, without any changes to your rules when you go to http://wouldyourathers.co.uk/question/1231
you should have /question/1231
in $_GET['url']
in dispatch.php
script.
You could parse that url with PHP and recover your question id:
$parts = explode('/', $_GET['url');
if ($parts[1] == 'question') {
$question_id = $parts[2];
// you could even do $_GET['qid'] = $parts[2];
}
Upvotes: 0
Reputation: 143886
Before your other rules, you can try adding this:
RewriteRule ^/question/([0-9]+)$ /?qid=$1 [L,QSA]
Upvotes: 1