.htaccess tutorial

htaccess Elite


how do i create nice urls for a query string?

Ask your mod_rewrite and Redirection questions here, and get answers!

how do i create nice urls for a query string?

New postby anrpalmer » 10 Jan 2008 15:50

hi, im new to mod_rewrite and need a bit of help.

I'd like to create some user friendly URLs that point to a php file. So something like:

http://www.domain.com/people/joe_bloggs

will pull up:

http://www.domain.com/people/view.php?name=joe_bloggs

currently my .htaccess file looks like this. but its not working. all help appreciated...


RewriteEngine on
RewriteBase /
RewriteRule ^/people/([A-Za-z0-9])?$ /people/view.php?name=$1 [L,NC]


This isn't working. What should the rule be?
anrpalmer
 
Posts: 1
Joined: 10 Jan 2008 15:41

New postby rewritecond » 17 Jan 2008 03:15

Code: Select all
domain.com/people/joe_bloggs ->
domain.com/people/view.php?name=joe_bloggs


Code: Select all
RewriteEngine On
RewriteBase /
RewriteRule ^/people/([A-Za-z0-9]+)?$ /people/view.php?name=$1 [L,NC]
rewritecond
 
Posts: 33
Joined: 30 Jan 2007 11:20


Return to Redirect or Rewrite Questions