redirect without id

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 5
Joined: 10 Feb 2013, 17:39

redirect without id

04 Apr 2014, 10:33

Hi, I have this re-direct that works fine.

Code: Select all
RewriteCond %{QUERY_STRING} ^profileid=([^&]+)&galleryname=([^&]+)$
RewriteRule ^gallery\.asp$ gallery/%1_%2? [NC,R=301,L]

#rewrite back to old-URL
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^gallery/([^_]+)_([^_]+)$ /gallery.asp?profileid=$1&galleryname=$2 [NC,L]


It returns a url like
http://www.mysite.com/gallery/3_name

My question is it possible to remove the number to get just

http://www.mysite.com/gallery/name

Thanks for any help in advance
All the best
Richard

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: redirect without id

04 Apr 2014, 15:39

Hello,

Is the number constant? If it's dynamic, we need to store this parameter in a URL... we may change it to "/gallery/3/name", but that's about it.

Regards

User avatar
Posts: 92
Joined: 01 Dec 2012, 14:22

Re: redirect without id

11 Apr 2014, 07:43

If there's a fixed relationship between name and number, perhaps a mapfile would help?

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: redirect without id

11 Apr 2014, 09:43

good catch!

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 0 guests