Rule help
4 posts
• Page 1 of 1
Rule help
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.
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.
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Rule help
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:
Regards
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
Re: Rule help
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
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
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Rule help
Try:
Regards
- 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
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 0 guests