ISAPI Redirect 3 Filter 301 Redirect with subdomain
4 posts
• Page 1 of 1
- blurryphoenix
-
- Posts: 2
- Joined: 04 Sep 2013, 11:33
ISAPI Redirect 3 Filter 301 Redirect with subdomain
I'm very new in terms of writing rules for ISAPI Rewrite 3 from Helicon (licensed version) to be used for IIS6. I need to write 90+ rules for different pages from "subdomain.domain.com" to "www.domain.com", and I'm not very familiar with RegEx patterns. Unfortunately, these sites don't mirror, so doing a simple query string append won't work.
Example: Redirect "http://subdomain.domain.com/products/product.aspx?id=42" to "http://www.domain.com/productgroup/productinfo"
I have a pretty good start on it, however the furthest I've gotten is to get a specific page redirect to work. I need to get it down to the specific ID for some of these pages to redirect differently. Currently, the code I have for the web page redirect to Google (just for testing purposes) is
NOTE: I just created a simple website with the following pages:
- /index.html
- /subfolder/subfolder.html
- /subfolder/subfolder2.html
- /subdir/subdir.html
According to the previous code, "/subfolder/subfolder.html" redirects to Google and the others show the page normally. For testing purposes, I've been trying to append "id=1" to redirect to YouTube and "id=2" to redirect to Facebook, and neither of those are working at the moment. The code for that is
All I need is to get a pattern that works, then I can modify it from there to make it work for the rest of the pages.
Thank you for any responses!
Example: Redirect "http://subdomain.domain.com/products/product.aspx?id=42" to "http://www.domain.com/productgroup/productinfo"
I have a pretty good start on it, however the furthest I've gotten is to get a specific page redirect to work. I need to get it down to the specific ID for some of these pages to redirect differently. Currently, the code I have for the web page redirect to Google (just for testing purposes) is
- Code: Select all
# Helicon ISAPI_Rewrite configuration file
# Version 3.1.0.102
RewriteEngine on
RewriteRule ^(subfolder.html)/?(.*)$ http://www.google.com/ [NC,R=301,L]
NOTE: I just created a simple website with the following pages:
- /index.html
- /subfolder/subfolder.html
- /subfolder/subfolder2.html
- /subdir/subdir.html
According to the previous code, "/subfolder/subfolder.html" redirects to Google and the others show the page normally. For testing purposes, I've been trying to append "id=1" to redirect to YouTube and "id=2" to redirect to Facebook, and neither of those are working at the moment. The code for that is
- Code: Select all
RewriteRule ^(subfolder2.html\?id=1)$ http://www.youtube.com/ [NC,R=301,L]
RewriteRule ^(subfolder2.html\?id=2)$ http://www.facebook.com/ [NC,R=301,L]
All I need is to get a pattern that works, then I can modify it from there to make it work for the rest of the pages.
Thank you for any responses!
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: ISAPI Redirect 3 Filter 301 Redirect with subdomain
Hello,
Please, take a look at "URLs with question mark don't work" in FAQ (http://www.helicontech.com/forum/10648-FAQ.html) this will help you resolve the problem.
Regards
Andrew
Please, take a look at "URLs with question mark don't work" in FAQ (http://www.helicontech.com/forum/10648-FAQ.html) this will help you resolve the problem.
Regards
Andrew
- blurryphoenix
-
- Posts: 2
- Joined: 04 Sep 2013, 11:33
Re: ISAPI Redirect 3 Filter 301 Redirect with subdomain
Thank you for the response. I tried altering that a bit to work with my need, and it's still not redirecting at all.
Here's the new code I have
And here's the Rewrite.log that I have with it
I can see from the log file that it's correctly seeing the query string, but it doesn't seem to be going passed that. It looks as though the pattern may still be wrong.
Here's the new code I have
- Code: Select all
RewriteCond %(QUERY_STRING) ^id=(\d+)$ [NC]
RewriteRule ^subfolder2\.html$ http://www.youtube.com/watch?v=%1? [NC,R=301,L]
And here's the Rewrite.log that I have with it
- Code: Select all
127.0.0.1 127.0.0.1 Thu, 05-Sep-2013 10:06:43 GMT [dev.isapiredirect.com/sid#7][rid#19444472/initial] (2) init rewrite engine with requested uri /subfolder/subfolder2.html?id=1
127.0.0.1 127.0.0.1 Thu, 05-Sep-2013 10:06:43 GMT [dev.isapiredirect.com/sid#7][rid#19444472/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
127.0.0.1 127.0.0.1 Thu, 05-Sep-2013 10:06:43 GMT [dev.isapiredirect.com/sid#7][rid#19444472/initial] (1) Htaccess process request c:\projects\isapiredirecttestpage\.htaccess
127.0.0.1 127.0.0.1 Thu, 05-Sep-2013 10:06:43 GMT [dev.isapiredirect.com/sid#7][rid#19444472/initial] (3) applying pattern '^subfolder2\.html$' to uri 'subfolder/subfolder2.html'
I can see from the log file that it's correctly seeing the query string, but it doesn't seem to be going passed that. It looks as though the pattern may still be wrong.
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: ISAPI Redirect 3 Filter 301 Redirect with subdomain
Hi,
Correct, the following line tells you exactly why:
You request "/subfolder/subfolder2.html?id=XYZ" and the pattern in the rule requires the path to start with /subfolder2.html?id=XYZ
Just tweak the rule a little more... and create several variations of it to match all possible scenarios.
Regards
Andrew
Correct, the following line tells you exactly why:
- Code: Select all
(3) applying pattern '^subfolder2\.html$' to uri 'subfolder/subfolder2.html'
You request "/subfolder/subfolder2.html?id=XYZ" and the pattern in the rule requires the path to start with /subfolder2.html?id=XYZ
Just tweak the rule a little more... and create several variations of it to match all possible scenarios.
Regards
Andrew
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 21 guests