httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martijn <sweetwaterg...@googlemail.com>
Subject Re: [users@httpd] Mod_Rewrite from old dynamic page
Date Tue, 13 Nov 2007 17:25:55 GMT
On Nov 13, 2007 5:10 PM, Ki Song <ki@knifecenter.com> wrote:
> How would I write a mod_rewrite rule for the following:
> OLD URL: http://store.knifecenter.com/pgi-ProductSpec?productSKU
> NEW URL: http://www.knifecenter.com/kc_new/store_detail.html?s=productSKU
>
> Is there a way to pass the productSKU to the new url?

How about:

  RewriteCond %{HTTP_HOST} ^store.knifecenter.com$ [NC]
  RewriteCond %{QUERY_STRING} ^(.*)$ [NC]
  RewriteRule ^pgi-ProductSpec$
http://www.knifecenter.com/kc_new/store_detail.html?s=%1

(I haven't checked this.)

In human language: the first line checks if the host is
store.knifecenter.com, the second line puts the full query_string (the
bit after the ? in the URL) into %1 and the second line does the
actual rewriting.

Martijn.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message