Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder ahayzen's Avatar
    Join Date
    Jun 2009
    Posts
    110
    Thanks
    8
    Thanked 11 Times in 11 Posts

    Redirect example.com/robots.txt to example2.com/example/robots.txt

    Hi I have a parked domain (example.com) and I am trying to redirect them to the primary address (example2.com) but within a folder.

    So requests for
    example.com/robots.txt
    would go to
    example2.com/example/robots.txt

    I also need it to work with and without www.

    The current code i have got is
    Code:
    RewriteCond %{HTTP_HOST} ^example.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.example.com$
    RewriteCond %{REQUEST_URI} ^\/robots\.txt
    RewriteRule ^/?$ "http\:\/\/www\.example2\.com\/example\/robots\.txt" [R=301,L]
    but it doesn't work.

    Thanks in advance

    Andy

  • #2
    Regular Coder ahayzen's Avatar
    Join Date
    Jun 2009
    Posts
    110
    Thanks
    8
    Thanked 11 Times in 11 Posts
    Or if you can work out a way of redirecting
    example.com/*
    to
    example2.com/example/*

    That would be even better.

    Andy

  • #3
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,866
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    I don't think, you can place the robots.txt file of a domain under another one.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #4
    Regular Coder ahayzen's Avatar
    Join Date
    Jun 2009
    Posts
    110
    Thanks
    8
    Thanked 11 Times in 11 Posts
    After a bit of head scratching and lots of reading I've done it
    Code:
    RewriteCond %{HTTP_HOST} example.com
    RewriteCond %{REQUEST_URI} !^/example
    RewriteRule ^(.*)$ example/$1 [L]

  • #5
    Regular Coder ahayzen's Avatar
    Join Date
    Jun 2009
    Posts
    110
    Thanks
    8
    Thanked 11 Times in 11 Posts
    This thread can be marked as Resolved


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •