Welcome to WebmasterWorld Guest from 54.161.105.39

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Getting .htaccess to do what I want

     

rajuabju

2:54 pm on Sep 24, 2003 (gmt 0)

Inactive Member
Account Expired

 
 


Alright, here is my issue:

I have a folder on my domain that I no longer use (its empty), but that a lot of people have bookmarked, search engines point to, etc etc. Everything in that folder has been moved to a different folder (but not in the same structure). I want to use .htaccess to redirect all traffic from the old folder to the new one, such that no matter what is the original target url, everyone is redirected to the index file of the new folder.

[domain.com...] redirects to [domain.com...]

There were lots of subdirectories in old folder, individual jpg files indexed by google, and so on and so forth. I want it to work so that no matter what was trying to be accessed under the old folder or its subdirectories, the person is always sent to newfolder.

I know it can be done with a .htaccess file... I had it working until my hosting provider screwed stuff up and now I don't remember the code :( Please help

3:26 pm on Sept 24, 2003 (gmt 0)

Full Member

10+ Year Member

joined:Aug 21, 2003
posts:203
votes: 4



ErrorDocument 404 http://www.domain.com/newfolder

Is the simplest way to do it.

There are others but this'll do it in the simplest manner placed in the oldfolder directory.

If your old directory structure had any relevance to the new directory structure or if it had keywords etc. in either the path or filename then we can adapt the above to point to a search page on your site with the keyword as the search term ensuring that relevant content is displayed rather than a plain index page.

Jason Duke

7:24 pm on Sept 24, 2003 (gmt 0)

Full Member

10+ Year Member

joined:Aug 20, 2003
posts:255
votes: 0


Welcome to WebmasterWorld [webmasterworld.com], rajuabju!

To get started with your problem, try reading this thread first:

[webmasterworld.com ]

It's similar to what you're trying to do. This may also come in handy:

[httpd.apache.org ]

8:03 pm on Sept 24, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 22, 2002
posts:2546
votes: 0


RewriteEngine on
RewriteRule ^/old_folder/.*$ /new_folder/ [L]

...should work

Birdman