Rule help

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 2
Joined: 03 Mar 2014, 18:43

Rule help

03 Mar 2014, 18:50

I'm completely new to regex and having difficulty formulating a rule.

I have 4 urls I want to re-write:

https://burrito.com/llservlet/livelink/open/11111111
https://burrito.com/llservlet/livelink/ ... s/11111111
https://burrito.com/.../?objID=11111111&...
https://burrito.com/.../?nodeid=11111111&

I need to extract the number off of each of these urls and rewrite it as the following.

https://tacos.com/sites/wgcredir/_layou ... d=11111111


Thanks. I appreciate any guidance/help.

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

Re: Rule help

03 Mar 2014, 23:12

Hello,

There's no way we can do all of those in one rule. It's impossible and is not necessary.
Try using the following in your .htaccess:

Code: Select all
RewriteEngine on
RewriteBase /

##/llservlet/livelink/open/11111111 OR llservlet/livelink/properties/11111111
RewriteCond %{HTTPS} on
RewriteRule ^llservlet/livelink/[^/]+/(\d+) https://tacos.com/sites/wgcredir/_layouts/food.metadata/Redirect.aspx?obj_id=$1 [NC,P,L]

## objID=11111111& OR nodeid=11111111&
RewriteCond %{HTTPS} on
RewriteCond %{QUERY_STRING} ^(?:objID|nodeid)=([^&]+).* [NC]
RewriteRule .+ https://tacos.com/sites/wgcredir/_layouts/food.metadata/Redirect.aspx?obj_id=%1? [NC,P,L]


Regards

User avatar
Posts: 2
Joined: 03 Mar 2014, 18:43

Re: Rule help

04 Mar 2014, 18:38

Andrew,

Thanks for your reply. The first rule seems to be working, but the second does not. This could be due to me not providing all the information from our example URL, but based on my understanding, it does look like yours should work. Do you see anything wrong?

URLs:
https://burrito.com/llservlet/livelink? ... viewType=1
https://burrito.com/llservlet/livelink? ... viewType=1

Should rewrite as:
https://tacos.com/sites/wgcredir/_layou ... id=1111111

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

Re: Rule help

05 Mar 2014, 00:50

Try:

Code: Select all
## objID=11111111& OR nodeid=11111111&
RewriteCond %{HTTPS} on
RewriteCond %{QUERY_STRING} (?:objID|nodeid)=([^&]+).* [NC]
RewriteRule .+ https://tacos.com/sites/wgcredir/_layouts/food.metadata/Redirect.aspx?obj_id=%1? [NC,P,L]


Regards

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 0 guests