#1 (permalink)  
Old 04-17-2006, 10:54 AM
curtiss's Avatar
Moderator
 
Join Date: May 2003
Posts: 1,445
htaccess redirects

I am using an htaccess file to redirect users from our old web address to a new web address. Basically, the contents of my htaccess file are as follows:

Code:
Redirect 301 /DCHelp http://dchelp.net
However, I am still keeping some images and files on the old server, and would like to be able to use them in my pages.

Is there a way to disable that redirect for one single sub-directory, so that the image tags won't be re-directed? Right now, my images aren't showing up, and I'd like to disable that redirect for the directory in which those files reside.

It is possible for me to move the files if necessary, I'm just curious how someone would go about redirecting everything but a single directory with htaccess.

Thanks.
__________________
I hate Internet Explorer! Anyone with me?
Reply With Quote

  #2 (permalink)  
Old 04-17-2006, 03:51 PM
Deadeye's Avatar
Moderator
 
Join Date: Aug 2005
Location: San Diego, CA
Posts: 274
Send a message via MSN to Deadeye
Change the redirect to be a JavaScript redirect on index.html. When someone hits your old URL they will be redirected via the JavaScript on the main page.

This should leave your images and other files intact on that web server

Wesley
Reply With Quote
  #3 (permalink)  
Old 04-17-2006, 03:54 PM
Till's Avatar
Administrator
 
Join Date: Jan 2002
Location: Berlin, Germany
Posts: 1,453
Curtiss,

you need to use Apache's rewrite rules. Ask your host if "mod_rewrite" is enabled for that.

Also, when you "redirect" using JavaScript, this will "kick off" spiders and so on.

Till
Reply With Quote
  #4 (permalink)  
Old 04-17-2006, 05:19 PM
curtiss's Avatar
Moderator
 
Join Date: May 2003
Posts: 1,445
Yes, mod_rewrite is available on my server.

I tried messing some with the rewrite feature, but I have very little experience with that, so I didn't have much success.
__________________
I hate Internet Explorer! Anyone with me?
Reply With Quote
  #5 (permalink)  
Old 04-17-2006, 05:24 PM
Till's Avatar
Administrator
 
Join Date: Jan 2002
Location: Berlin, Germany
Posts: 1,453
Quote:
Originally Posted by curtiss
Yes, mod_rewrite is available on my server.

I tried messing some with the rewrite feature, but I have very little experience with that, so I didn't have much success.
We use mod_rewrite to create (what's called) searchengine-friendly urls.

Give me an example of how the images moved, and or how you want to "redirect" or "transform" the path, and I'll try to come up with an example for you.
Reply With Quote
  #6 (permalink)  
Old 04-17-2006, 09:15 PM
curtiss's Avatar
Moderator
 
Join Date: May 2003
Posts: 1,445
Well, here's the whole story. I'm not sure how much of this will help you, so I'll try to include all of it:

We purchased a new hosting package, as well as a few more domains. We moved our Perl forums (YaBB 2.1) from http://dcevolution.net/cgi-bin/yabb/YaBB.pl (path to script was basically /mnt/www/cgi-bin/yabb/YaBB.pl) to http://dreamzoneboards.com/cgi-bin/YaBB.pl (path to script is basically /mnt/www/cgi-bin//dreamzoneboards.com//YaBB.pl) (I'm not sure the significance of the double backslashes, but they are in the path). I put an htaccess in /mnt/www/cgi-bin/yabb/ to re-direct all requests of that directory over to http://dreamzoneboards.com/cgi-bin/. Also, since we bought the domain "dreamzoneboards.com" to be specifically for our boards, I put an htaccess file in dreamzoneboards.com's root HTML directory (which would be something like /mnt/www/public_html//dreamzoneboards.com//) that redirects to http://dreamzoneboards.com/cgi-bin/.

The images are contained within http://dcevolution.net/DCHelp/yabb/images/ (let's say the path is /mnt/www/public_html/DCHelp/yabb/images/). There is also a redirect inside http://dcevolution.net/DCHelp which redirects all traffic of that directory over to http://dchelp.net (which is on a different hosting plan than the others).

So, basically, whenever someone attempts to load any of the images from within http://dcevolution.net/DCHelp/, the server now redirects them to http://dchelp.net/. I tried moving my files to http://dreamzoneboards.com/images, and found that the redirect in there also stops the images from loading.

Are you confused yet? I know I am.
__________________
I hate Internet Explorer! Anyone with me?
Reply With Quote
  #7 (permalink)  
Old 04-18-2006, 08:39 AM
Till's Avatar
Administrator
 
Join Date: Jan 2002
Location: Berlin, Germany
Posts: 1,453
Quote:
Originally Posted by curtiss
Are you confused yet? I know I am.


Ok, try something like this on your new server:

Code:
RewriteEngine On
RewriteRule   ^/images/(.*)$        http://yourolddomain/yabb/images/$1 [L]
Assuming you link /images/foo/bar.gif on your "new site", it should [L]ink it to your old domain to http://yourolddomain/yabb/images/foo/bar.gif. I hope!
Reply With Quote
  #8 (permalink)  
Old 04-18-2006, 08:41 AM
Till's Avatar
Administrator
 
Join Date: Jan 2002
Location: Berlin, Germany
Posts: 1,453
Oh - and if it doesn't work. Check your error_log, it will contain information about what went wrong. If it doesn't, your host needs to enable the rewrite_log.

Also, I am not sure which Apache your host is using, but check the docs:
http://httpd.apache.org/docs/

There's an entire section dedicated to the rewrite module.

Cheers,
Till
Reply With Quote
Reply


Thread Tools
Display Modes 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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re-directs Without htaccess curtiss Servers 3 04-13-2005 10:30 AM


All times are GMT -5. The time now is 01:32 PM.

 
Bitrix
Clicky Web Analytics
CloudContacts
Maxtango


Subscribe to our feed | add to myYahoo!

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
© 1997-2007 HTMLCenter