Results 1 to 5 of 5
  1. #1
    Join Date
    January 17th, 2005
    I was wondering how I could change a URL from a query string to a directory? Example: Change the URL from TO

  2. #2
    Full Member
    Join Date
    January 18th, 2005
    If you are on a unix server you need to use a mod_rewrite rule in your .htaccess file.

    It may look something like this
    RewriteEngine on
    RewriteRule search/(.*)/ search.cgi?search=$1 [L]

    Search the forums here or google "mod_rewrite search engine friendly url"

  3. #3
    Join Date
    January 17th, 2005
    Is it possible to do this without using a .htaccess file?

  4. #4
    ABW Ambassador FFoc's Avatar
    Join Date
    January 18th, 2005
    If you're using PHP, you can do this without having to rewrite any urls at the server level. PHP has a facility called 'Extra path information' that is available for your use (has been since before 2000, I used it on a project around then).

    The only caveat, IIRC, is that you must call the full script name.

    Ex: <pre class="ip-ubbcode-code-pre"></pre>

    The variable $PATH_INFO will contain the string '/search/some+string' which you can break out using something like explode().

    See this document @ for more details on how to use this.

    Also note, this facility was copied whole from the same facility in Perl. A Google search for the term 'CGI extra path' will come up with many examples
    ďAn adventure is an inconvenience rightly considered. An inconvenience is an adventure wrongly considered.Ē - G.K. Chesterton

  5. #5
    I like traffic lights
    Join Date
    January 18th, 2005
    Southern hemisphere - away from Fukushima
    yes, you don't need to put mod_rewrite rules in an .htaccess file.

    The best location is your apache config file, usually in the virtualhost container for the site in question.

  6. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Dynamic URLs vs. static URLs
    By Georgie Peri in forum Midnight Cafe'
    Replies: 9
    Last Post: January 30th, 2009, 09:39 PM
  2. Affiliate URLs Vs. Merchant URLs
    By MyDayRegistry in forum Midnight Cafe'
    Replies: 2
    Last Post: March 11th, 2008, 11:25 PM
  3. New format
    By jerseyjim in forum Midnight Cafe'
    Replies: 0
    Last Post: May 3rd, 2005, 10:02 PM
  4. asinsearch.format and grid list format
    By speedcreed in forum Scripts
    Replies: 1
    Last Post: August 21st, 2003, 08:50 AM
  5. New Format
    By Haiko de Poel, Jr. in forum Midnight Cafe'
    Replies: 36
    Last Post: August 24th, 2002, 12:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts