I am using a script that is called every time a special keyword combination is in query string - on all of my domains that are located on my server. I am using .htaccess files on every domain that have the following lines:

        RewriteBase /

        RewriteCond some_conditions_here
        RewriteRule .* myspecialscript.php [L,QSA]

Because of I am working sometimes on the rewrite conditions I have to modify all .htaccess of every virtual host. But I have running a server frontend software that allows to include automatically a special part in every virtual host configuration file - so I want to port the rewirte rule above to work in virtual host configuration. But what I have done - I failed. Rewrite conditions are recognized correctly - but rewriting itself fails.

I have tried the following two:

<IfModule mod_rewrite.c>
        RewriteEngine On

        RewriteCond some_conditions_here
        RewriteRule ^/(.*) https://%{HTTP_HOST}/myspecialscript.php [L,QSA]
        RewriteRule .* myspecialscript.php [L,QSA]

First fails with "...too much redirections...", second one (of course because of missing rewrite base) with error 400.

Of course I added only ONE of the rules at one time - but both fail with errors as above. What is the problem?

1 Answer 1


Too silly. I simply forget the trailing / at the target....

You must log in to answer this question.

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