This question already has an answer here:
i've an index.php page & have some posts on that.when read more button is clicked the user is redirected to all.php which contains full post.actually,the url on all.php lokks like this
http://localhost/project/all.php?rm=How%20to%20create%20jQuery%20Popup
i want to change %20
to -
. is there anyway to do this with htaccess.?
</div>
RewriteEngine On
RewriteBase /
# external redirect from actual URL to pretty one (remove query string)
RewriteCond %{THE_REQUEST} \s/+content\.php\?page=([^\s&]+) [NC]
RewriteRule ^ %1? [R=302,L,NE]
# convert all space (%20) to hyphen
RewriteRule "^(\S*) +(\S* .*)$" $1-$2 [N,NE]
RewriteRule "^(\S*) (\S*)$" $1-$2 [L,R=302,NE]
# rewrite rule to call actual PHP handler
RewriteRule ^([^./]+)\.html$ content.php?page=$1 [L,QSA,NC]