0

Update

Now that I know what I didn't know when I posted this question, this questions looks pretty stupid. The answer is no, the no-referrer meta tag does not affect the way htaccess redirects. However, it can cause one issue at least. The hot-linking prevention uses the HTTP-REFERER; so setting the meta tag to content=no-referred, provides no data for that rule set. Instead of getting rid of it, I just set content to same-origin and get the same desired result.

But that does not solve the issue, at least it didn't for me. When both the redirect and hot-linking prevention rule sets are in the same htaccess file, one can get something akin to an endless loop. Once I learned a bit more about what was placed in the htaccess file, I was able to reduce it a great deal and then make the two rule sets mutually exclusive using the REQUEST_URI to get the file extension. Whichever file types are placed in the hot-linking prevention, I excluded from the redirect rule set and it finally all worked.

I did not expect shared hosting to be so lacking in security. I suppose if something like Wordpress is used, then access to other security features are made available, unless I was misinformed by the host support. But I don't use those tools and don't want to.

If someone in a position to know and with the authority to do so feels this question is of no worth, then please delete it. It may not be of any value to to anyone else.


I am trying to understand why the meta tag for no-referrer would interfere with the redirect and hot-link prevention in an htaccess file in a shared hosting environment on LiteSpeed.

For several days the host support couldn't get a redirect and hot-link prevention to both work at the same time. If the redirect worked, then any site could hot link the files. If the hot-link prevention worked then the redirect either wouldn't work or the site couldn't access its own files.

There are three domain names, name_1.org (the primary domain on the account), name_1.com, and name_2.com. The latter two domains are set up as add-on domains on the primary account. All three are being redirected to https://www.name_2.name_1.org, whether entered with or without the www.

The host support claims that the issue is due to my placing <meta name="referrer" content="no-referrer"> in the head of the HTML files. I must admit that removing it does result in the redirection and hot-link protection both working together. However, it makes no sense to me why the referrer information would affect either of these two items.

I made a local HTML page and placed the same meta tag in the head and the equivalent in a link to the sites files, and a link to the site pages using one of the URLs that requires redirection; and it all works fine. The redirection takes place and the files cannot be hot-linked.

Is there any reason why the referrer would affect these items? The redirection and hot-link code from the htaccess files is below. This htaccess file is at the public_html directory and the second block under public_html/name_2 directory. It looks overly messy to me but I'm pretty new to this area.

Thank you.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^name_1\.org$ [OR]
RewriteCond %{HTTP_HOST} ^www\.name_1\.org$
RewriteCond %{HTTP_HOST} ^name_1\.org$ [OR]
RewriteCond %{HTTP_HOST} ^www\.name_1\.org$ [OR]
RewriteCond %{HTTP_HOST} ^name_1\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.name_1\.com$ [OR]
RewriteCond %{HTTP_HOST} ^name_2\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.name_2\.com$
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/(?:\ Ballot169)?
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Sectigo\ DCV)?$
RewriteRule ^/?$ "https\:\/\/www\.name_2.name_1\.org" [R=301,L]

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://name_2.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://name_2.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://name_2.name_1.org/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://name_2.name_1.org$      [NC]
RewriteCond %{HTTP_REFERER} !^http://name_1.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://name_1.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://name_1.org/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://name_1.org$      [NC]
RewriteCond %{HTTP_REFERER} !^http://name_1.name_1.org/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://name_1.name_1.org$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.name_2.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.name_2.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.name_2.name_1.org/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.name_2.name_1.org$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.name_1.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.name_1.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.name_1.org/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.name_1.org$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.name_1.name_1.org/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.name_1.name_1.org$      [NC]
RewriteCond %{HTTP_REFERER} !^https://name_2.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^https://name_2.com$      [NC]
RewriteCond %{HTTP_REFERER} !^https://name_2.name_1.org/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^https://name_2.name_1.org$      [NC]
RewriteCond %{HTTP_REFERER} !^https://name_1.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^https://name_1.com$      [NC]
RewriteCond %{HTTP_REFERER} !^https://name_1.org/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^https://name_1.org$      [NC]
RewriteCond %{HTTP_REFERER} !^https://name_1.name_1.org/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^https://name_1.name_1.org$      [NC]
RewriteCond %{HTTP_REFERER} !^https://www.name_2.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^https://www.name_2.com$      [NC]
RewriteCond %{HTTP_REFERER} !^https://www.name_2.name_1.org/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^https://www.name_2.name_1.org$      [NC]
RewriteCond %{HTTP_REFERER} !^https://www.name_1.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^https://www.name1.com$      [NC]
RewriteCond %{HTTP_REFERER} !^https://www.name_1.org/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^https://www.name_1.org$      [NC]
RewriteCond %{HTTP_REFERER} !^https://www.name_1.name_1.org/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^https://www.name_1.name_1.org$      [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

In public_html/name_2 appears this code first and then a repeat of the hot_linking prevention code from above.

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/(?:\ Ballot169)?
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Sectigo\ DCV)?$
RewriteCond %{HTTP_HOST} ^name_2\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.name_2\.com$
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/(?:\ Ballot169)?
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Sectigo\ DCV)?$
RewriteRule ^/?$ "https\:\/\/www\.name_2\.name_1\.org\  " [R=301,L]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.