0

I am trying to redirect all vhosts to a certain url based on the REQUEST_URI.

For example if somebody makes a request to www.something.com/condition on my server to be redirected to google.com

I included a file in my httpd-vhsots.config and inside I have:

RewriteEngine on
RewriteCond "%{REQUEST_URI}" "^/condition"
RewriteRule "^/(.*)$" "https://www.google.com/" [R=permanent,L]

<VirtualHost *>
  RewriteEngine on
  RewriteOptions inherit
</VirtualHost>

So far I have no luck so I decided to ask for some help.

Where is the best place to include this file - on the top or on the bottom of the httpd-vhosts.config?

1 Answer 1

0

My vhosts file is automatically generated so I added to the script this lines

RewriteEngine on
RewriteCond "%{REQUEST_URI}" "^/condition"
RewriteRule "^/(.*)$" "https://www.google.com/" [R=permanent,L]

to be inserted for each vhost and now its working fine.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .