Sample Header Ad - 728x90

transfer .htaccess rewrite to apache vhost configuration

0 votes
1 answer
43 views
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:
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?
Asked by df8oe (1 rep)
Aug 26, 2020, 08:30 AM
Last activity: Aug 26, 2020, 09:03 AM