A
A
Andrey Romanov2014-04-30 18:09:59
PHP
Andrey Romanov, 2014-04-30 18:09:59

How to redirect to a new domain while keeping the paths after the slash?

Hello.
I need to set up a redirect from the old domain to the new one, but in such a way that the path after the slash is preserved, for example: the old domain is example.ru, the new one is example.com. The user requests the page example.ru/?p=101 and is redirected to example.com/?p=101, not to example.com.
PS Site on WordPress.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
kfuntov, 2014-04-30
@kfuntov

For apache in htaccess

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

A
Artyom Sysolyatin, 2014-05-02
@pingvi69

On the hosting of the old domain, make a .htaccess file with the following content:
Don't forget to replace newdomain.com with your NEW domain.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question