Forum Moderators: phranque

Message Too Old, No Replies

I just dont get the Redirects

         

roostermt

6:55 pm on Jul 24, 2005 (gmt 0)

10+ Year Member



Hi all,

I'm very new here.

Maybe someone can help. I've searched the forum and there are many examples of a similiar problem but I just can't figure it out.

I simply need to redirect all my pages in a subdirectory to my root domain name.

Example

[mydomain.com...]
to
httP//www.mydomain.com

I'm looking to use some sort of redirect or rewrite I have Cpanel access but I just don't get what I should use.

I do want a permanent redirection as I won't be using the sub directory any logner.

Any help from the experts here?

Rooster

Longhaired Genius

8:08 pm on Jul 24, 2005 (gmt 0)

10+ Year Member



This will do what you want, in a .hatccess file in your website's root folder.

# begin .htaccess

Options +FollowSymlinks
RewriteEngine on

RewriteRule ^sub/.*$ [mydomain.com...] [R=301,L]

# end .htaccess

It may not actually be the best thing to do. Do your deleted pages have corresponding existing pages you could redirect visitors to?

Welcome to Webmaster world.

roostermt

8:25 pm on Jul 24, 2005 (gmt 0)

10+ Year Member



Yes...

I still have the pages in the subdirectory and have copied the pages over to the root of the domain.

So for each page in the subdirectory there is a a twin.

I have a couple of hundered pages.

Thanks

Rooster

jdMorgan

8:40 pm on Jul 24, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In that case, use:

RewriteRule ^sub/(.*)$ http://www.mydomain.com/$1 [R=301,L]

Jim

g1smd

11:03 am on Jul 25, 2005 (gmt 0)

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



I am curious as to why you moved everything into the root?

I keep very little in the root, and prefer to have content in multiple keyword-named subfolders with breadcrumb navigation.