.htaccess

How to Block All Bots Inluding Google Bot, and All Other Bots With Htaccess

耗尽温柔 提交于 2021-02-08 09:24:23
问题 How can i block all Bots with htaccess. All bots means all Bots, Not even Google or any Bot Should Access My Site. I am Using custom index.html Page in my site, and in back-end Wordpress is also installed. 回答1: There is no way to ban all, but you could ban some well known ones. To block Google, Yandex, and other well known search engines, check their documentation, or add HTML robots NOINDEX, nofollow meta tag. For Google check Googlebots bot doc they have. Or simply add Google bots:

How do I use service workers with an htaccess protected directory?

我与影子孤独终老i 提交于 2021-02-08 07:34:20
问题 I'm trying some basic service workers. The service worker itself will work normally the first time the service worker is registered. The problem I always get is once the person revisits the website in the future (e.g. the following day) and tries to access a .htaccess / .htpasswd protected directory. Instead of getting the dialog box, as normal, they go straight to a 401 error. This is how I am registering the service worker in script tags in the HTML. if ('serviceWorker' in navigator) {

URL/Subdomain rewrite (htaccess)

给你一囗甜甜゛ 提交于 2021-02-08 07:28:30
问题 My application dynamically creates sub domains. If just the subdomain is used (no other path): mydomain.mysite.com I need the subdomain to remap/rewrite (keep the same URL so its hidden from the user) to the following url mydomain.mysite.com/event/mydomain In the instance where there are other parameters passed then I want to ignore the rewrite rule. ( mydomain.mysite.com/something/else ) I'm having trouble with the following endind up in a redirect loop RewriteEngine on RewriteCond %{HTTP

http to https redirection using .htaccess not working

烂漫一生 提交于 2021-02-08 07:00:59
问题 I want to redirect http://myip/admin to https://myip/admin. I am trying to use .htaccess to do this (want this only for the admin folder). Contents of .htaccess placed in the relevant folder: RewriteEngine On RewriteCond %{HTTPS} !on RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} (apache mod_rewrite is enabled). Both http://myip/admin and https://myip/admin are visible (but the redirection does not work). Server is Ubuntu. I have tried few variations of the above rules from the internet

RewriteRule without FollowSymLinks or SymLinksIfOwnersMatch

我只是一个虾纸丫 提交于 2021-02-08 06:37:56
问题 I'm running into some problems with rewriting my URLs. Recently moved to a new host where FollowSymLinks and SymLinksIfOwnersMatch is not allowed as options in my .htaccess file. Using these will give me a 500 error. Mod_rewrite is however enabled on the host. Normally my rewriting code looks like the code below and works perfectly: Options +FollowSymLinks RewriteEngine on RewriteRule ^link/(.*)$ link.php?urlkey=$1 [QSA] But with removing +FollowSymLinks the rewriting doesn't work. Any idea

RewriteRule without FollowSymLinks or SymLinksIfOwnersMatch

落花浮王杯 提交于 2021-02-08 06:37:37
问题 I'm running into some problems with rewriting my URLs. Recently moved to a new host where FollowSymLinks and SymLinksIfOwnersMatch is not allowed as options in my .htaccess file. Using these will give me a 500 error. Mod_rewrite is however enabled on the host. Normally my rewriting code looks like the code below and works perfectly: Options +FollowSymLinks RewriteEngine on RewriteRule ^link/(.*)$ link.php?urlkey=$1 [QSA] But with removing +FollowSymLinks the rewriting doesn't work. Any idea

htaccess: Remove and disable file ending

为君一笑 提交于 2021-02-08 05:11:46
问题 I'd plastered all over the Internet that this code in your .htaccess file will remove the file ending: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php However, although enables the URL without file ending, it does not disable the URL with file ending. Essentially, what I'd like to force any attempt for an request with file ending (domain.com/sample.php) to end up without file ending (domain.com/sample) I'm sure someone

AngularJS SSL .htaccess woes

佐手、 提交于 2021-02-08 02:12:24
问题 I'm trying to enable the use of SSL on my .htaccess file that has already been set up for html5Mode direct linking but it's always resulting in a redirect loop. The closest question I've found on stackoverflow is this but even from here I can't figure it out (I'm new to htaccess files). AngularJS html5Mode direct linking htaccess file is RewriteEngine on RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^ index.html [L] and this works

AngularJS SSL .htaccess woes

一个人想着一个人 提交于 2021-02-08 02:05:21
问题 I'm trying to enable the use of SSL on my .htaccess file that has already been set up for html5Mode direct linking but it's always resulting in a redirect loop. The closest question I've found on stackoverflow is this but even from here I can't figure it out (I'm new to htaccess files). AngularJS html5Mode direct linking htaccess file is RewriteEngine on RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^ index.html [L] and this works

.htaccess doesn't escape question mark on RewriteRule

佐手、 提交于 2021-02-07 20:55:14
问题 I have a website with an old type of Single Sign On. A parent website sends users to my website with a URL like: http://test.instela.fm/index.php?gid=abcd1234&u=thedewil&id=11472 and I want to rewrite it as this: http://test.instela.fm/login/abcd1234/thedewil/11472 I have created a .htaccess file as following: RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^index.php?gid=(.*)&u=(.*)&id=(.*)$ login/$1/$2/$3 [L] I tried escaping the question mark in the URL