Plus signs

Using mod_rewrite to handle various content issues

Plus signs

Postby JimBrashear » Thu Feb 28, 2008 9:01 am

I'm doing a rewrite where the client has a part of their URL like this:

N=36+2

They NEED that plus sign - it's not just a space. My question is this: they have suggested we replace the plus sign using modrewrite with a capital X then they can convert it back on their end. How does one do this?

The original URL is like this:

catalog.asp?N=36+4&Ne=1

I want to rewrite it to be like this:

36X4-1.asp

Basically grab the N and the NE values.
JimBrashear
 
Posts: 4
Joined: Mon Jan 07, 2008 9:36 am

Postby richardk » Fri Feb 29, 2008 12:53 pm

So /36X4-1.asp to /catalog.asp?N=36X4&Ne=1? Try the following in a .htaccess file in your document root
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^([0-9]+X[0-9]+)-([0-9]+)\.asp$ /catalog.asp?N=$1&Ne=$2 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Content

Who is online

Users browsing this forum: No registered users and 13 guests

cron