Search code examples
phpjoomlasefjoomla-sef-urls

Search Engine Friendly Url but URL should NOT be inserted in the DB


I have a Search Page and I'd like to have an SEF URL but I don't want to have it inserted in the DB. Eg. www.abc.com/facility-search/types/state/city/

www.abc.com/facility-search/school/california/los-angeles/ or www.abc.com/facility-search/school+hospital/california/los-angeles/ where the type is delimited using '+'

There are thousands of combination so I don't want to index them in the db Is there a way to do this without the SH404SEF inserting them to the db?

I want to be able to paste the url to a browser and then just parse anything that comes after facility-search. (i wont have an equivalent url with parameters)

Thanks a lot


Solution

  • Ofcourse. you could use .htaccess for a QSA Query apending string. So in your given example this would be something like:

    RewriteRule ^facility-search/(.*)$ index.php?search=$1 [QSA,L]  
    

    and you can than catch it in your php to perform actions strip them down or anything else so catch it as:

    $pathArray = explode('/', $_GET['rt']);
    

    Now you exploded it you can do anything you like with it. The url: www.abc.com/facility-search/school/california/los-angeles/ will give the following output

    $pathArray[0]; // returns 'school'
    $pathArray[1]; // returns 'california'
    $pathArray[2]; // returns 'los-angeles'
    

    I hope you understand the concept.