Help with content rules and redirecting only the root of a domain

0

I have tried multiple ways of doing this but I have not been able to succeed in making it work properly.  We are currently handling this in apache but would like to speed it up by moving it to the load balancer.  I want to redirect all traffic to just the root of domain.xyz.com to newdomain.xyz.com.  Any requests to directories like domain.xyz.com/somefolder I want to pass through.  Both of these services are in the load balancer and being handled properly, just current the root folder request redirect is happening in apache.  Any idea on how to make this work?  Everytime I write a rule it either doesn't work or sends all traffic not just root traffic to the other service.

I am running a vlm-1000 version: 7.2.37.1.14531.RELEASE.20170201-0233

### send root url request to SharePoint
RewriteRule ^$ /index.php [PT,L,QSA]
### Check if the file exists in root ###
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
### If not rewrite to homepage ###
RewriteRule (.*) https://newdomain.xyz.com/ [R=301,L]

4 comments

Avatar
0
Mark Deegan

Hello Jason,

You should create a rule as the following

Rule name = Redirect_root

rule type = replace header

Header field = Host

match string = /domain.xyz.com.*/

Value of header filed to be replaced = newdomain.xyz.com

perform if Flag set = unset

Avatar
0
jkuter

This will redirect the root and everything under it.  I need to redirect the root only and not all the folders under it.

http://domain.xyz.com -> https://newdomain.xyz.com (redirected)

http://domain.xyz.com/wiki (no redirection)

http://domain.xyz.com/blogs (no redirection)

etc....

 

Avatar
0
matts

Watching...

Avatar
0
Tony Vaughan

Morning,

for this scenario I would try the following,

the logic would be
if possible create two sub virtual services

the first for the root directory "/"
the second for and other paths

for http://domain.xyz.com/ send to sub VS 1 and then trigger a 302 redirect to the http://newdomain.xyz.com/
for http://domain.xyz.com/test send to sub VS 2 and then to the real servers as normal


Content match for root "/"
Rule Type: Content Matching
Match Type: Regular Expression
Header field: <Blank>
Match String: /^\/$/
Ignore Case enabled

for the 302 redirect
Under subVS1 -> Advanced Properties -> Not Available Redirection Handling
Error code 302 found
Redirect URL: http://newdomain.xyz.com/