What is needed is that https://cpc.dev.company.eu should redirected to 404 page, and all other like https://cpc.dev.company.eu/* and app1.dev.company.eu & app1.dev.company.eu/* should work as it is.
in nutshell what i want is only home page of cpc.dev.company.eu should be redirected
<VirtualHost *:8080>
ServerName app1.dev.company.eu
ServerAlias *-app1.dev.company.eu *-cpc.dev.company.eu cpc.dev.company.eu
Timeout 300
DocumentRoot "/srv/www/app1/public"
Header set Access-Control-Allow-Origin "*"
ErrorLog "/var/log/httpd/app1_error_log"
CustomLog "/var/log/httpd/app1_access_log" proxy
<Directory "/srv/www/app1/public">
Options Indexes FollowSymlinks MultiViews
AllowOverride None
Require all granted
DirectoryIndex index.php
# Rewrite rules
RewriteEngine On
# Code to block cpc home page
RewriteEngine on
RedirectMatch 301 ^cpc.dev.company.eu https://cpc.dev.company.eu/404?
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
</Directory>
<FilesMatch "\.php$">
SetHandler proxy:fcgi://127.0.0.1:9071
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
</FilesMatch>
SetEnv NEWRELIC_APP_NAME "app1 - dev"
SetEnv APP_ENV "dev"
not working
RedirectMatch 301 ^cpc.dev.company.eu https://cpc.dev.company.eu/404?
not working
RewriteCond %{HTTP_HOST} ^cpc.acc.company.eu [NC]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^$ https://cpc.dev.company.eu/404? [R=301,L]
Works but along with home page of cpc.dev.company.eu the app1.dev.company.eu home page also redirects to 404 page
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^$ https://cpc.dev.company.eu/404? [L,R=301]