John
John

Reputation: 231

Beginner mod_rewrite question

how would I rewrite in .htaccess:

url.com/NAME to url.com/view.php?=NAME

I've tried a couple of variations but I think i might be putting a slash in the wrong place. Any suggestions?

Upvotes: 0

Views: 28

Answers (1)

arkigos
arkigos

Reputation: 362

RewriteEngine on
RewriteRule ^(\w+)$ /view.php?somevar=$1 [L]

You have to set NAME as the value of some variable.

This example allows NAME to be any word.. if you want something specific... just replace \w+ with whatever specific thing you want.

Upvotes: 1

Related Questions