2

I'm sure that's been asked zillions times but i can't get it to work, i'm trying to rewrite a url with querystring, my url is for example:

http://example.com/articles/index.php?keyword=book

and i want to be accessible from

http://example.com/articles/keyword/book/

I google it and i didn't have any luck, am i on the right track? i got this:

RewriteCond %{QUERY_STRING}     ^keyword=(.*)$    [NC]
RewriteRule ^/articles/index.php$         /articles/keyword/$1          [NC,L,R=301]

UPDATE

this is working fine

RewriteEngine On
Options +FollowSymLinks
RewriteBase /
RewriteRule ^.*/(\w+)\b$ /articles/index.php?keyword=$1

1 Answer 1

3

It should work:

RewriteRule ^articles/keyword/(.*)/?$ index.php?keyword=$1

If not, please tell me ;)

Sign up to request clarification or add additional context in comments.

2 Comments

What's the problem? What Apache gives? What's in the error logs?
that finally worked for me, RewriteRule ^.*/(\w+)\b$ /articles/index.php?keyword=$1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.