How to change the url with httacces

Hello,

I dont know how to work with httacces and i realy want to make clean urls, can i change url like i ask here below ?

Pagination : http://example.com/index.php?search=&submit=search&page=2
in to this
Pagination: http://example.com/search/page/2.html

I try this but nothing hapen.

RewriteEngine On
RewriteRule ^([^/])/([^/])/page/([^/]*).html$ /index.php?search=$1&submit=$2&page=$3 [L]

Thanks in advance

I think you need some quantifiers in there.

RewriteRule ^([^/]+)/([^/]+)/page/([^/]*).html$ /index.php?search=$1&submit=$2&page=$3 [L]

Also, be aware that rewrite rules don’t “change” URLs per se. They enable the alternate, clean version of the URL. If you type the ugly URL into the address bar, it’ll still work. This rewrite makes it so that you can also type the pretty URL into the address bar, and it’ll work too.

2 Likes