Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QUESTION Convert querystring with Fancy URLS
Hi All.
This is one of the url RewriteRule problems that i've struggled with for years. I just can't get my heed around it.  Confused

I have a venues listing page that pulls data from an existing MySQL DB on my server. The slug is venues.

I've also go a venue details page (slug venue) that reads the querysting so the page can query the MySQL DB to display full details of the venue.

The url is

Question: Is is possible to have a the Friendly URL such as:

Help and advice welcomed please.
Seasonal good wishes to you all.

Cheers n beers.
It's not just a simple mod_rewrite problem, to do this, you'll need to change your script.
If "fancy url" is enabled and a native page "venues" really exist, no further .htaccess changes is required.
You'll need to find the position in your script who the "?vid=Old+Punch+House" param is attached to the URL, so you'll need to change that to something like "/old-punch-house", for example. To achieve this, you can use a function like this:

PHP Code:
function createslug($text)
$text preg_replace('~[^\pL\d]+~u''-'$text);
$text iconv('utf-8''us-ascii//TRANSLIT'$text);
$text preg_replace('~[^-\w]+~'''$text);
$text trim($text'-');
$text preg_replace('~-+~''-'$text);
$text strtolower($text);


Later you can read the parameter with:
PHP Code:
$slug get_page_slug(false); 

good luck
Doing this with GS is a problem as GS automatically uses the last path as slug

you would need a rewrite rule to catch the venue/ and convert it to
?id=venue&venue=$2 or something
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
That's right I'd forgotten

Then you'll need something like this:

RewriteRule ^venue/([A-Za-z0-9-\+]+)/?$ index.php?id=venue&vid=$1 [NC,L,QSA]

It allow you to link to something like /venue/Old-Punch-House but not /foo/Old-Punch-House...

Users browsing this thread: 1 Guest(s)
Free HDTV Channels Residential Solar Panels