<div class="site_search">
  <form method="get" action="<?php echo SITE_URL; ?>search.php">
      <input type="hidden" name="active"  />
      <select name="by">
          <optgroup>
              <option> Songs</option>
              <option> Singers</option>
          </optgroup>
      </select>
      <input name="search" placeholder="Search..." type="text">
      <input type="submit" value="Search">
  </form>
</div>

The Above is my Html Form Code after hitten the and inputting the data into search bar
my form will redirect the user to http://domain.com/search.php?active=&by=Singers&search=haroon+bacha
as you can see the action attribute has <?php echo SITE_URL; ?>search.php
the main purpose to my post is how to convert this complex default url pattern into clear and clear url and friendly for the users or search engines like http://domain.com/search/singers or songs/keywords i.e haroon + bacha
please tell me the url pattern for my .htaccess file thanks!

Recommended Answers

All 2 Replies

What you can do is redirect everything to index.php, then in index.php you read your URI by using $_SERVER['REQUEST_URI'], and then parsing that info. E.g. if REQUEST_URI returns "page/a-nice-html-page/" you could explode that data on the "/", scan that array and take the required actions in index.php. E.g. if $return[0] = page and $return[1] = a-nice-html-page you can include a page file called a-nice-html-page.

I have solved this issue searching on google.com and now i have awesome urls for my search.php quering page Thanks for your kind reply.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.