Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-24-2010, 01:11 PM   PM User | #1
ahayzen
Regular Coder

 
ahayzen's Avatar
 
Join Date: Jun 2009
Posts: 110
Thanks: 8
Thanked 11 Times in 11 Posts
ahayzen is an unknown quantity at this point
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
ahayzen is offline   Reply With Quote
Old 05-24-2010, 01:15 PM   PM User | #2
ahayzen
Regular Coder

 
ahayzen's Avatar
 
Join Date: Jun 2009
Posts: 110
Thanks: 8
Thanked 11 Times in 11 Posts
ahayzen is an unknown quantity at this point
Or if you can work out a way of redirecting
example.com/*
to
example2.com/example/*

That would be even better.

Andy
ahayzen is offline   Reply With Quote
Old 05-24-2010, 01:45 PM   PM User | #3
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,689
Thanks: 158
Thanked 2,184 Times in 2,171 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
I don't think, you can place the robots.txt file of a domain under another one.
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Old 05-24-2010, 01:48 PM   PM User | #4
ahayzen
Regular Coder

 
ahayzen's Avatar
 
Join Date: Jun 2009
Posts: 110
Thanks: 8
Thanked 11 Times in 11 Posts
ahayzen is an unknown quantity at this point
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]
ahayzen is offline   Reply With Quote
Old 05-24-2010, 01:52 PM   PM User | #5
ahayzen
Regular Coder

 
ahayzen's Avatar
 
Join Date: Jun 2009
Posts: 110
Thanks: 8
Thanked 11 Times in 11 Posts
ahayzen is an unknown quantity at this point
This thread can be marked as Resolved
ahayzen is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:47 PM.


Advertisement
Log in to turn off these ads.