Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Website and Server Administration Forum


You are currently viewing our Website and Server Administration Forum as a guest. Please register to participate.
Login



Reply
htaccess - Redirecting from a directory to a different domain
Old 03-04-2008, 09:37 PM htaccess - Redirecting from a directory to a different domain
Chimpie's Avatar
Novice Talker

Posts: 12
Trades: 0
I need to redirect visitors from olddomain.com/directory to newdomain.com. I've set up my htaccess with...

Redirect 301 /directory http://www.newdomain.com

... and it works, but if someone goes to olddomain.com/directory/news.htm, they go to that page. They don't get redirected.

What do I need to write so that if someone goes to any file in /directory they are sent to just newdomain.com?

Thanks,

Chimp
Chimpie is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-04-2008, 10:22 PM Re: htaccess - Redirecting from a directory to a different domain
Chimpie's Avatar
Novice Talker

Posts: 12
Trades: 0
Okay, its working, not exactly how I wanted, but better.

With the following written...

Redirect 301 /directory http://www.newdomain.com

... if I go to www.olddomain.com/directory it takes me to www.newdomain.com. That's fine.

But if I go to www.olddomain.com/directory/whatever.htm it takes me to www.newdomain.com/whatever.htm. This is okay for this site as the page will be the same.

For future use it would be nice to know how to go to from www.olddomain.com/directory/whatever.htm to just newdomain.com. I probably need to throw a wildcard in there, but I tried a lot of different things and I couldn't figure it out.
Chimpie is offline
Reply With Quote
View Public Profile
 
Old 03-05-2008, 02:02 AM Re: htaccess - Redirecting from a directory to a different domain
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
Redirect 301 /directory.* url
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 03-06-2008, 01:49 PM Re: htaccess - Redirecting from a directory to a different domain
css25's Avatar
Average Talker

Posts: 17
Name: Jerry
Location: Home
Trades: 0
To redirect ALL files on your domain use this in your .htaccess file if you are on a unix web server:

redirectMatch 301 ^(.*)$ http://www.domain.com
redirectMatch permanent ^(.*)$ http://www.domain.com

You can also use one of these in your .htaccess file:

redirect 301 /index.html http://www.domain.com/index.html
redirect permanent /index.html http://www.domain.com/index.html
redirectpermanent /index.html http://www.domain.com/index.html
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
css25 is offline
Reply With Quote
View Public Profile Visit css25's homepage!
 
Reply     « Reply to htaccess - Redirecting from a directory to a different domain
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.14004 seconds with 12 queries