I have a configuration like this

<VirtualHost *:80>
ProxyPreserveHost Off
ProxyRequests Off
ServerName mooo.com
ServerAlias www.mooo.com
ProxyPass / http://localhost:8000/
ProxyPassReverse / http://localhost:8000/

RewriteEngine  on
RewriteRule    "^/foo\.html$"  "/admin/" [PT]


this is working fine . now i want to rewrite foo.html to some other external domain . say for example when user open mooo.com/foo.html i need to server example.com i tried

RewriteRule    "^/foo\.html$"  "http://example.com" [PT]

but not working how can i solve this issue ?


You can try below rewrite rule to proxy a page with external domain.

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/foo.html$
RewriteRule ^(.*)$ http://www.example.com/ [P]
  • Why use a RewriteCond to check against REQUEST_URI, when you could just use the RewriteRule pattern? – MrWhite Nov 10 '17 at 12:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.