Forum Moderators: phranque

Message Too Old, No Replies

.htaccess Question

Move a folder up one level

         

brnm98105

3:36 am on Oct 27, 2008 (gmt 0)

10+ Year Member



I think I understand. Tell me if I'm right

I have a folder

/images/stuff/widget-type1/wiget1.htm + a few other .htm files not listed
/images/stuff/widget-type1/wiget2.htm
/images/stuff/widget-type1/wiget3.htm
/images/stuff/widget-type1/wiget4.htm
/images/stuff/widget-type1/wiget5.htm

I want to move the /images/stuff folder up one level

Is this correct? will this redirect all files in the stuff file to the new location

redirect 301 /images/stuff/ http://www.example.com.com/stuff

Then i install the .htacces file to

/images/.htaccees

Do i have it correct?

or does it matter that theses files were originally done so deep in th site?

[edited by: jdMorgan at 2:10 pm (utc) on Oct. 27, 2008]
[edit reason] example.com [/edit]

g1smd

7:51 am on Oct 27, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Let's get a few things straight.

URLs are defined by "links", so on the pages of your site, you need to link to the URL that you want the user to see.

Now, having done that, a 301 redirect will cause the browser to request a new URL and the user will see that new URL.

If you want the user to see URL "X" while the content actually comes from location "Y" then you need a rewrite.

So, the question is, are you just changing the URL the user sees while leaving the content in the same physical place on the server, or are you actually moving the physical files up one level too, or something else?

brnm98105

1:41 pm on Oct 27, 2008 (gmt 0)

10+ Year Member



well i want to change a few urlnames to be more seo friendly.
like - /images/stuff/widget-type1/widget1.htm to brandname-of-widget.html

but also want to move the stuff folder up one level.

Thamks for any help

g1smd

2:28 pm on Oct 27, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Yes, but what I asked is: are you changing only the URLs "up one level", or are you also physically moving the files "up one level" on the server too?

That determines whether you need only a redirect from old URL to new URL, or whether you also need an internal rewrite to connect the new URL request back to the proper internal server location.

brnm98105

5:33 pm on Oct 27, 2008 (gmt 0)

10+ Year Member



Im sorry. I am physically moving the entire folder up one level on the server along with renaming a few folders and files.
thanks for any help.

jdMorgan

12:12 am on Oct 28, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You'll need to include the trailing slash on the new URL as well:

Redirect 301 /images/stuff/ http://www.example.com.com/stuf[b]f/[/b]

Otherwise, it should work as you desire.

Jim

brnm98105

2:20 pm on Oct 28, 2008 (gmt 0)

10+ Year Member



Thanks Jim. Can yo explain trailing slash?

jdMorgan

11:44 pm on Oct 28, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Your code would have redirected /image/stuff/logo.gif to /stuffimage.gif, because the slash was missing.

Jim

brnm98105

8:34 pm on Oct 29, 2008 (gmt 0)

10+ Year Member



Thanks Jim I appreciate you help!