homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

Getting .htaccess to do what I want

10+ Year Member

Msg#: 397 posted 2:54 pm on Sep 24, 2003 (gmt 0)

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



10+ Year Member

Msg#: 397 posted 3:26 pm on Sep 24, 2003 (gmt 0)

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


10+ Year Member

Msg#: 397 posted 7:24 pm on Sep 24, 2003 (gmt 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 ]


WebmasterWorld Senior Member 10+ Year Member

Msg#: 397 posted 8:03 pm on Sep 24, 2003 (gmt 0)

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

...should work


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved