Forum Moderators: phranque

Message Too Old, No Replies

.htaccess question

         

brnm98105

4:57 pm on Sep 27, 2008 (gmt 0)

10+ Year Member



I have a site structure that has a folder I want to move and lots of files in that folder I want to rename . Example

Redirect /images/products http://example.com/products/

Would this redirect all traffic to the new folder and take care of all files Im needing to rename? Is it that simple or is it more complicated?

[edited by: jdMorgan at 5:25 pm (utc) on Sep. 27, 2008]
[edit reason] Use example.com please [/edit]

jdMorgan

5:28 pm on Sep 27, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You'll need to add a trailing slash to the URL-path on the left side, or remove the one from the URL on the right side -- Either way is OK, just be consistent. Also, specify a 301-Moved Permanently redirect:
 Redirect 301 [i]old-local-URL-path[/i] [i]new-URL[/i] 

The default is a 302-Found (Moved Temporarily), and can confuse search engines

Regardless, the Redirect directive will take any requested URL that matches the local-URL-path prefix specified on the left, and redirect it to the URL-prefix specified on the right, after appending any URL-path-parts present in the requested URL, but not specified in the local-URL-path prefix on the left. So in your case (after correcting the slash issue noted above), if http://example.com/images/products/widget is requested, the redirect is to http://example.com/products/widget -- "widget", not being part of the specified local-URL-path prefix on the left, is copied from the requested URL to the new URL.

Be aware that changing URLs is not something that search engines like; They see the Web as an archival library, not as a newstand. Therefore, you can expect all redirected URLs to lose all or much of their search engine ranking for a period of a few weeks up to 9 months or so -- The depth and duration varies depending on how often your URLs are spidered and their current PageRank/Link-popularity; Some sites see merely a blip; Others suffer significant and extended revenue loss while the search engines re-calculate PageRank/Link-popularity, and "TrustRank."

Using mod_rewrite rather than mod_alias, and assuming that your URL- and file-structure was well-organized to begin with, it is possibly to completely re-arrange your file structure [http://www.w3.org/Provider/Style/URI]without changing your URLs[/url] at all -- Be aware of this option.

Jim