Link to home
Start Free TrialLog in
Avatar of Respons
Respons

asked on

How to rewrite url with htaccess to be much simpler?

I have a webshop where there is a search field. When I search I am forwarded to a link looking like this:

webshopdomain.com/index.php?route=product/search&keyword=my search phrase

(webshopdomain.com/index.php?route=product/search&keyword=my%20search%20phrase )

What do I need to put in htaccess to do the same search by writing : webshopdomain.com/search/my%20search%20phrase
(and keep that url after)

I have been playing around with this tool ( http://www.webconfs.com/url-rewriting-tool.php ) , but haven't understood how to just grab the search phrase and put that into a static url.

I have also been googling, but in lack of the correct wording, I haven't found the answer.

The issue seams to be just retracting the search phrase and nothing else, and put that into a new url...
SOLUTION
Avatar of requeue
requeue

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Respons
Respons

ASKER

Him and thanks.

I thought so too, but I can not get it to work.

I forgot to mention that there exist a htaccess from before. Looks lie this:


Options +FollowSymlinks
Options -Indexes
<FilesMatch "\.(tpl|ini)">
 Order deny,allow
 Deny from all
</FilesMatch>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php?_route_=$1 [L,QSA]

Open in new window


ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Respons

ASKER

Hi, and thanks again.

It didn't work.

But after testing a lot I found that if I put the
RewriteRule ^search/(.*)$  index.php\?route=product/search&keyword=$1

BEFORE


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php?_route_=$1 [L,QSA]


it works ;-)

Thanks!
Avatar of Respons

ASKER

Solved