Forum Moderators: phranque

Message Too Old, No Replies

move all request from a directory to other

move all request from a directory to other

         

alfredo_gz

3:41 pm on Jan 25, 2011 (gmt 0)

10+ Year Member



Hello Friends,

I've moved my site to another directory:

www.mydomain.com/web to www.mydomain.com

i've moved all the content from the web directory to the root. but Google has indexed all my web with the Web directory such as:

www.mydomain.com/wev/es/contact.html but now is
www.mydomain.com/es/contact.html

how can i do this?

many thanks in advance

Alfredo

g1smd

4:01 pm on Jan 25, 2011 (gmt 0)

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



A simple one-line RewriteRule with [R=301,L] flags should do the trick.

What have you tried so far?

alfredo_gz

6:53 pm on Jan 25, 2011 (gmt 0)

10+ Year Member



Thanks g1smd,

do you have one example? i'm new with .httaccess

Thanks

Alfredo

g1smd

8:01 pm on Jan 25, 2011 (gmt 0)

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



There are more than 75 000 threads in this forum. More than 10 000 of them include code for redirects.

You'll likely need a RewriteRule and the [R=301,L] flags.

jdMorgan

6:01 pm on Feb 7, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




Redirect /web/ http://www.example.com/
-or-
RedirectMatch ^web/(/(.*))?$ http://www.example.com/$2
-or-
RewriteRule ^web/(/(.*))?$ http://www.example.com/$2 [R=301,L]

These are all essentially identical in function, except that the last two can handle the missing trailing slash on requests for just "example.com/web, and so prevent mod_dir from having to be invoked to correct that missing slash.

See the Apache mod_alias and mod_rewrite documentation for more info. Links to other useful resources are in our Apache Forum Charter, and several example and tutorial threads are in our Apache Forum Library.

Jim