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.ph p?route=pr oduct/sear ch&keyword =my search phrase
(webshopdomain.com/index.p hp?route=p roduct/sea rch&keywor d=my%20sea rch%20phra se )
What do I need to put in htaccess to do the same search by writing : webshopdomain.com/search/m y%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...
webshopdomain.com/index.ph
(webshopdomain.com/index.p
What do I need to put in htaccess to do the same search by writing : webshopdomain.com/search/m
(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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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/s earch&keyw ord=$1
BEFORE
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php?_route_=$1 [L,QSA]
it works ;-)
Thanks!
It didn't work.
But after testing a lot I found that if I put the
RewriteRule ^search/(.*)$ index.php\?route=product/s
BEFORE
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php?_route_=$1 [L,QSA]
it works ;-)
Thanks!
ASKER
Solved
ASKER
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:
Open in new window