views:

36

answers:

3
+1  Q: 

PHP Mod_Rewrite

I'm trying to use mod_rewrite to achieve the following rewrite:

From - http:// pre.domain.com/public/?project=Awesome

To - http:// pre.domain.com/project/Awesome

Can't seem to figure it out (despite reading through endless sites). Any help?

+1  A: 
RewriteEngine On
RewriteCond  %{QUERY_STRING}   ^project=(.*)$
RewriteRule   ^/public/         /project/%1/? [R,L] # strip off query string

You need to match against the query string using a RewriteCond.

Ian Wetherbee
A: 

Not sure you have your URLs around the right way so I think your are trying to do this:

RewriteRule ^project/(Awesome) /public/?project=$1 [L]
Treffynnon
+1  A: 
RewriteEngine On
RewriteRule ^project/(.*) /public/?$1 [L,NC]
Inigoesdr