Htaccess redirect all content from domain/folder t

2019-08-06 23:11发布

I have a website here:

Wordpress Site

Now, i need to redirect all requests to that domain/directory to otherdomain, in this case designcenter.com.ve while keeping folder hierarchy as it is, for example:

http://olddomain/wordpress/post - to - http://newdomain/post or maybe http://newdomain/wordpress/post

Already tried some answers here, but no still luck, no redirecting and plus had to delete htaccess and restore permalinks on wordpress.

Somebody could shed some light on this?

Thanks in advance!

3条回答
甜甜的少女心
2楼-- · 2019-08-06 23:30

Give this a shot.

 <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

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

    </IfModule>
查看更多
劳资没心,怎么记你
3楼-- · 2019-08-06 23:31

I always prefer the popular Redirection plugin. Since you don't need to touch the .htaccess file. And you can manage everything from Wordpress Admin itself

Update:2: You can find all the basic redirect rules here.

Use this in regex... (Based on your usecase)

 Source: /(.*) 
 Target: http://newdomain.com/$1

UPDATE: I noticed... you haven't updated the permalinks in your 2nd site... Do that first and then also see the site URL is properly mentioned in your wordpress admin settings page.

查看更多
地球回转人心会变
4楼-- · 2019-08-06 23:36

You just need this rule but make sure this rule is your first rule in your DocumentRoot/.htaccess of olddomain.com:

RewriteRule ^wordpress(/|$) http://www.newdomain.com%{REQUEST_URI} [L,NC,NE,R=301]

In case your .htaccess is in /wordpress/.htaccess then use:

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

as your first rule.

查看更多
登录 后发表回答