Home URL rewriting in VirtualHost causes 403 Forbidden
Reply: 0

URL rewriting in VirtualHost causes 403 Forbidden

user934
1#
user934 Published in June 18, 2018, 7:39 am

My frontend server is handled by Apache 2.4.

I would like that when accessing http://198.51.100.13/site1/, it automatically redirects the traffic to my server's port 1001 like this:

<VirtualHost *:80>
ServerName 198.51.100.13
<Directory "/">
Require all granted
</Directory>

RewriteEngine On
RewriteRule ^/site1(.*)$ http://localhost:1001$1 [P,L]
RewriteRule ^/site2(.*)$ http://localhost:1002$1 [P,L]
RewriteRule ^/site3(.*)$ http://localhost:1003$1 [P,L]
</VirtualHost>

Problem: I get this error when opening http://198.51.100.13/site1/:

403: Forbidden
You don't have permission to access /areallybigpage on this server.

On the other hand, if I do http://198.51.100.13:1001/, it works (there is a Python serveron port 1001, but this is not important for this question).

How to solve this?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.371453 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO