Question

how to block redirects? (apache)

Posted December 16, 2015 6.5k views
Ubuntu Apache WordPress Security LAMP Stack DigitalOcean DNS

Hi,
There is a domain that is not my property, “digitalbellies.com”, performing a redirect on my domain “vrwebsolutions”. I saw through Whois pointing to my nameserver.

So if I go on “digitalbellies.com” I view the same content as “vrwebsolutions.com”

How do I block and avoid all this?

regards,

CarenZ.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

2 answers

Hey Caren,

Here is a tutorial that talks about how to create a redirect.

You could place a .htaccessfile in the main web directory which is usually /var/ww/html/ by default. You would place the following lines in that file:

RewriteEngine on
RewriteCond %{HTTP_REFERER} ^http://(www\.)? digitalbellies\.com [NC]
RewriteRule (.*)    - [F]

If you’re using Ubuntu, you’d want to also make sure that mod_rewrite is enabled by running a2enmod rewrite. If you did need to enable mod_rewrite, you would need to restart Apache for thta to take effect - service apache2 restart

Happy coding,

Jon Schwenn
Platform Support Specialist
DigitalOcean

by Justin Ellingwood
HTTP redirects are used to redirect web site visitors to new locations when they request content. These are useful for a variety of reasons, whether permanent or temporary. This guide will demonstrate how to redirect visitors using Apache and Nginx.

Your website has been clickjacked by another user. To make sure your website is click jacked open the website in google chrome and press F12 to open developer tools and you could iframe enabled for your website. Add the below apache config .

Header always append X-Frame-Options DENY

Submit an Answer