skip to Main Content

I need to redirect a specific URL (with structure) to a the same URL(s) using a new domain, but not other URLS.

domainA.com/company/careers*

domainB.com/company/careers*

The reason for this is a 3rd party vendor supplying a jquery based iframe app that perfoms a referrer check before loading.

I realize there is a bigger seo/duplicate content issue that needs to be addressed, but there is a lot of additional work that needs to happen before domainA.com is fully redirected to domainB.com so for now, Its only the “career” section.

The site is using IIS6 with HeliconTech’s ISAP ReWrite3

http://www.helicontech.com/isapi_rewrite/doc/introduct.htm

Current Rules:

# Helicon ISAPI_Rewrite configuration file
# Version 3.1.0.59

<VirtualHost www.domainA.com www.domainB.com> 

RewriteEngine On 

#RewriteBase /
#RewriteRule ^pubs/(.+).pdf$ /404/?pub=$1.pdf [NC,R=301,L]

# Send away some bots
RewriteCond %{HTTP:User-Agent} (?:YodaoBot|Yeti|ZmEu|MorfeusScanner) [NC] 
RewriteRule .? - [F]

# Ignore dirctories from FarCry Friendly URL processing
RewriteCond %{REQUEST_URI} !(^/measureone|^/blog|^/demo|^/_dev)($|/) 
RewriteRule ^([a-zA-Z0-9/-%:[]{}|;<>?,*!@#$ ()^_`~]*)$ /index.cfm?furl=$1 [L,PT,QSA] 

RewriteCond %{REQUEST_URI} ^/company/careers [NC]
RewriteRule ^company/careers/?(.*)$ http://www.domainname.com/company/careers/$1 [R=301,L]

# Allow CFFileServlet requests
RewriteCond %{REQUEST_URI} !(?i)^[\/]CFFileServlet


RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /blog/index.php [L]

</VirtualHost> 

<VirtualHost blog.domainA.com> 

RewriteEngine On 

#redirect old blog.domainA.com/* posts to www.domainB.com/blog/*
RewriteCond %{HTTP_HOST} ^blog.domainA.com [nc]
RewriteRule (.*) http://www.domainB.com/blog$1 [R=301,L]


</VirtualHost> 

2

Answers


  1. Just check to see if the request starts with /company/careers

    RewriteEngine On
    RewriteCond %{REQUEST_URI} ^/company/careers [NC]
    RwriteRule ^company/careers/?(.*)$ http://domainB.com/company/careers/$1 [R=301,L]
    

    See if that works for you.

    Login or Signup to reply.
  2. It seems that “RewriteBase /blog/” line corrupts your “careers” rule as it implies that the request should be domainA.com/blog/company/careers*

    Please consider having it like this:

    <VirtualHost www.domainA.com www.domainB.com> 
    
    RewriteEngine On 
    RewriteBase /
    #RewriteRule ^pubs/(.+).pdf$ /404/?pub=$1.pdf [NC,R=301,L]
    
    # Send away some bots
    RewriteCond %{HTTP:User-Agent} (?:YodaoBot|Yeti|ZmEu|MorfeusFuckingScanner) [NC] 
    RewriteRule .? - [F]
    
    # Ignore dirctories from FarCry Friendly URL processing
    RewriteCond %{REQUEST_URI} !(^/measureone|^/blog|^/demo|^/_dev)($|/) 
    RewriteRule ^([a-zA-Z0-9/-%:[]{}|;<>?,*!@#$ ()^_`~]*)$ /index.cfm?furl=$1 [L,PT,QSA] 
    
    RewriteCond %{REQUEST_URI} ^/company/careers [NC]
    RewriteRule ^company/careers/?(.*)$ http://www.domainname.com/company/careers/$1 [R=301,L]
    
    # Allow CFFileServlet requests
    RewriteCond %{REQUEST_URI} !(?i)^[\/]CFFileServlet
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^blog/.* /blog/index.php [L]
    
    </VirtualHost> 
    

    If you still have issues, enable logging in httpd.conf by putting

    RewriteLogLevel 9
    

    and check how your request is processed in rewrite.log.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search