Redirecting all subdirectory to another site

General support questions
Post Reply
zamvil
Posts: 2
Joined: 2023/01/19 21:09:48

Redirecting all subdirectory to another site

Post by zamvil » 2023/01/19 21:30:56

Hi,
I'm moving my windows wordpress main portal to Centos 7 server and is working now and very fast.

But I want redirect all subdirectories to the windows server (IIS) less the root page.

for example.

This is my main page that is in centos server with wordpress
www.extranet.com

When the user browse www.extranet.com I want that stay there and open the wordpress

but if the user manually write down and browse www.extranet.com/subdirectory1, www.extranet.com/subdirectory2, www.extranet.com/subdirectory_N, I want to redirect to www.win_server.com/subdirectory1, www.win_server.com/subdirectory2, www.win_server.com/subdirectory_N.

I can't find something similar that I want.
I can do that en centos/apache?

Regards

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Redirecting all subdirectory to another site

Post by TrevorH » 2023/01/19 22:07:59

If you know that you want to redirect specific names then it's easy.

Code: Select all

ProxyPass /confluence http://windows.server/confluence
ProxyPassReverse /confluence http://windows.server/confluence
Repeat that pair for each name you want to redirect.

That's from an ancient httpd.conf I have from about 15 years ago. It also has

Code: Select all

ProxyRequests off
ProxyPreserveHost On
ProxyTimeout 3000
SSLPRoxyEngine On

<Proxy *>
    Order deny,allow
    Allow from all
</Proxy>
which may be required to make it all work.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

zamvil
Posts: 2
Joined: 2023/01/19 21:09:48

Re: Redirecting all subdirectory to another site

Post by zamvil » 2023/01/20 14:04:14

Thanks Trevor. And are there a general rule tha redirect all the subdirectories by default?

tunk
Posts: 1205
Joined: 2017/02/22 15:08:17

Re: Redirecting all subdirectory to another site

Post by tunk » 2023/01/20 14:11:01

Not sure if C7 is a good choice - it will die in 17 months time.
A better choice may be one of the rebuilds of RHEL8+9, like Rocky, Alma, etc.

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Redirecting all subdirectory to another site

Post by TrevorH » 2023/01/20 14:16:19

You can do all sorts of things with rewrite rules and probably with Proxy lines too but in general it's probably safer to redirect only known things to your windows server. Better to spend some time analyzing the logs and see what urls are used on there and then add specific redirect proxy lines for those and stop everything else going through.

The upstream Apache httpd docs are probably useful.

And I agree that deploying 7 at this late stage in its lifecycle is probably short sighted.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply