Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Rewrite advanced_search_result.php in friendly url


jf_evreux

Recommended Posts

Hi there,

 

i'm looking for an easy way (trough htaccess?) to rewrite the advanced_search_result.php in that kind of way :

 

advanced_search_result?keywords=mp3&subcat=1&search_in_description=1&cid=

 

to

 

search-mp3.html

 

I've looked everywhere but could'nt find a way to do it, any idea guys ?

 

Thank you, have a nice week end !

 

JF

Link to comment
Share on other sites

Try hacking Ultimate SEO URL's. It is a contribution that will do the same as you want for category and product pages, I am sure you could do it for advanced search results.

Link to comment
Share on other sites

Try hacking Ultimate SEO URL's. It is a contribution that will do the same as you want for category and product pages, I am sure you could do it for advanced search results.

 

thx, but i don't have the ability to hack anything in php ^^

 

I was hopping finding a way trough htaccess modification only?

Link to comment
Share on other sites

I assume you want to do this for search engine optimization so that customer searches would build hghly themed content pages automatically. Not a problem :)

 

First, you'll need to capture the customer search term(s) and store them in the database. Then, create a script called "recent_searches.php" and aggregate the data. Use that script to create the links to the static HTML files like you want and add a single line in the .htaccess file.

RewriteRule ^search-(.*).html$ advanced_search_result?keywords=$1&%{QUERY_STRING}

Link to comment
Share on other sites

thank you for answering.

 

In fact i just need the rewriting of the advanced_search_result.php file.

 

Yep i need this to make links to what i consider top searches (so i don't need to store recent searches) ;-))

 

I try to add this .htaccess files in the same directory than advanced_search_result.php :

 

RewriteEngine On

RewriteRule ^search-(.*).html$ advanced_search_result?keywords=$1&%{QUERY_STRING}

 

And then typed the url search-keyword.html but the advanced-search-result.php rewriting is not working, no page is displayed (404 error)...

 

Any clue of what i did wrong ?? Thanks again

Link to comment
Share on other sites

RewriteRule ^search-(.*).html$ advanced_search_result?keywords=$1&%{QUERY_STRING}

 

SHOULD BE

 

RewriteRule ^search-(.*).html$ advanced_search_result.php?keywords=$1&%{QUERY_STRING}

 

Notice the file extension was left off.

Link to comment
Share on other sites

RewriteRule ^search-(.*).html$ advanced_search_result?keywords=$1&%{QUERY_STRING}

 

SHOULD BE

 

RewriteRule ^search-(.*).html$ advanced_search_result.php?keywords=$1&%{QUERY_STRING}

 

Notice the file extension was left off.

 

 

yes i 've added the extension, but still not working...my site is hosted on a dedicated server, maybe there s something i've not configured to have the rewrite working...

Link to comment
Share on other sites

yes i 've added the extension, but still not working...my site is hosted on a dedicated server, maybe there s something i've not configured to have the rewrite working...

 

 

hi there,

 

i chek my server, and the rewrite mod is enable on Apache, so i can't figure out what's wrong with the htaccess code you gave me...any clue ??

 

Thanks,

 

JF

Link to comment
Share on other sites

  • 3 years later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...