清理URL重定向htaccess

i have a website SongsBar.com , when a query is searched on my website, the url in the browser displays like this - http://songsbar.com/download.php?q={search text}. i want it be appear like this http://songsbar.com/download/{search text}.html

First, you need to make sure Multiviews (mod_negotiation) is turned off, otherwise it'll mess with the /download/ and /download.php stuff.

Then you need to externally redirect requests for download.php

Then you need to internally rewrite the /download/ requests back to the php file (the browser is oblivious to this happening.

Options -Multiviews

RewriteEngine On

RewriteCond %{THE_REQUEST} \ /+download.php\?q=([^&\ ]+)
RewriteRule ^ /download/%1.html? [L,R=301,NE]

RewriteRule ^download/(.+)\.html$ /download.php?q=$1 [L,B,QSA]

The B flag may not be necessary. It depends on what kind of stuff you plan on putting in the parameter. The flag ensures that special characters get encoded.

http://httpd.apache.org/docs/current/mod/mod_rewrite.html

Something like : RewriteCond %{REQUEST_FILENAME}

.htaccess

   RewriteEngine On
   RewriteRule ^download/([^/]*)\.html$ /download.php?q=$1 [L]

You can achieve this with something along the lines of:

RewriteEngine On
RewriteBase /download/
RewriteCond %{REQUEST_FILENAME} !-f  #if the file actually exists don't rewrite
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.html$ /download.php?q=$1 [L]