Question

I have a hosting account on JustHost, my primary domain Is zdental.co, and I have the add-on domain zinapi.com, I am using the following code to restrict access to my subdomain from the primary domain (zinapi.zdental.co):

RewriteEngine On
RewriteOptions inherit

RewriteCond %{HTTP_HOST} ^zinapi.zdental.co$ [OR]
RewriteCond %{HTTP_HOST} ^www.zinapi.zdental.co$
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^(.*)$ - [L,R=404]

It works fine when I go to url zinapi.zdental.co (not found page is displayed), but when I go directly to zinapi.zdental.co/temp/ this is not working, can anyone help me?

Was it helpful?

Solution

Try this rule in the root .htaccess of zinapi.zdental.co:

RewriteEngine On

SetEnvIf Host ^ suppress-error-charset
ErrorDocument 404 "<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'></head><body>No se encontró la página que buscas, intenta ingresando a nuestra página principal</body></html>"

RewriteCond %{HTTP_HOST} ^(www\.)?zinapi\.zdental\.co$ [NC]
RewriteRule ^ - [L,R=404]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top