htaccess: you configured HTTP (80) on the standard HTTPS port (443)!

I currently have a website that runs under https and it works fine and I tried to do something in my .htaccess file so that when I try http://example.com it will redirect to https: //www.example .com however I have I have tried some of the following items and my redirect is not working: – .htaccess has been enabled with AllowOverride and has been read. – file name no problem. – the location of the rules has been moved to the beginning of the files but it doesn't work – The syntax was tested with the tool available online and was debugged without problems. Below is my .htaccess file for reference:

##
# @package    Joomla
# @copyright  Copyright (C) 2005 - 2018 Open Source Matters. All rights reserved.
# @license    GNU General Public License version 2 or later; see LICENSE.txt
##

##
# READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE!
#
# The line 'Options +FollowSymLinks' may cause problems with some server configurations.
# It is required for the use of mod_rewrite, but it may have already been set by your 
# server administrator in a way that disallows changing it in this .htaccess file.
# If using it causes your site to produce an error, comment it out (add # to the 
# beginning of the line), reload your site in your browser and test your sef urls. If 
# they work, then it has been set by your server administrator and you do not need to 
# set it here.
##

## No directory listings

  IndexIgnore *


## Suppress mime type detection in browsers for unknown types

Header always set X-Content-Type-Options "nosniff"
Header append X-FRAME-OPTIONS "SAMEORIGIN"
Header set Strict-Transport-Security "max-age=31536000" env=HTTPS


## Can be commented out if causes errors, see notes above.
Options +FollowSymlinks
Options -Indexes

## Mod_rewrite in use.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(^.)+.(^.)+$
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} (L,R=301)

## Begin - Rewrite rules to block out some common exploits.
# If you experience problems on your site then comment out the operations listed 
# below by adding a # to the beginning of the line.
# This attempts to block the most common type of exploit `attempts` on Joomla!
#
# Block any script trying to base64_encode data within the URL.
RewriteCond %{QUERY_STRING} base64_encode(^()*((^))*) (OR)
# Block any script that includes a 

htaccess: website was not redirected from non www to https + www

I am currently doing the www + https redirect where I hope my website can redirect from http://example.com to https://www.example.com but it doesn't work even if I have added the redirect in the .htaccess file . Below is my redirect that I have added in the .htaccess file and supposedly able to work since I search everywhere, this is the most common redirect I can find:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com (NC) 
RewriteRule ^(.*)$ https://www.example.com/$1 (L,R=301)

Although I have added this line and try to write http://example.com, somehow it is not redirected to https://www.example.com and the idea is over. I also tried adding a redirect in https-vhosts.conf and disabling it so it doesn't read the .htaccess file.
Below are the records I manage to obtain:

RewriteCond: input='www.example.com' pattern='^example.com' (NC) => not-matched
    RewriteCond: input='/index.php/news-and-events/news-and-events/news' pattern='(/|\.htm|\.php|\.html|/(^.)*)$' (NC) => matched
    RewriteCond: input='D:/wamp64/www/example/index.php' pattern='!-f' => not-matched
    RewriteCond: input='' pattern='mosConfig_(a-zA-Z_){1,21}(=|\%3D)' => not-matched
    RewriteCond: input='' pattern='base64_encode.*\(.*\)' => not-matched
    RewriteCond: input='' pattern='(\<|%3C).*script.*(\>|%3E)' (NC) => not-matched
    RewriteCond: input='' pattern='GLOBALS(=|\(|\%(0-9A-Z){0,2})' => not-matched
    RewriteCond: input='' pattern='_REQUEST(=|\(|\%(0-9A-Z){0,2})' => not-matched
    pass through D:/wamp64/www/example/index.php
init rewrite engine with requested URL /, referer: http://intranet/

My SSL was actually configured in https-ssl.conf, where I point my certificate to the httpd-ssl.conf file. I don't think I need to change my vhosts settings to 443 (currently using VirtualHost *: 80) since I pointed my certificate in httpd-ssl.conf file and my website now runs https + www. It is just what I want when someone type http://example.com in the browser, they will redirect them to https://www.example.com
Please tell me if I am doing something wrong and TIA!

apache: using .htaccess to assign a random path to a private directory

I am trying to implement a zero downtime implementation strategy for a static website using a .htaccess proceedings. I would like to access http://example.com/__staging__ The staging environment internally redirects all requests to the path that contains the actual data loaded (i.e. http://example.com/__private__/abcdefgh where abcdefgh is the hash of the commit). Meanwhile, directly open anything below http://example.com/__private__ It should be banned.

This is the .htaccess file I've written so far (which doesn't work):

RewriteEngine On

# This line seems to work correctly.
RewriteRule "__staging__(.*)$" "__private__$1" (PT,E=__staging__:1)

# These directives always forbid the access while, to my understanding, should
# trigger after a rewrite from 
RewriteCond %{ENV:__staging__} "!=1"
RewriteRule "__private__" "-" (F)

I have read https://httpd.apache.org/docs/2.4/mod/mod_rewrite.html, https://httpd.apache.org/docs/2.4/env.html and https: //httpd.apache. org / docs / 2.4 / rewrite / .. Surely I missed something, I'm stuck. Thank you!

htaccess: how can i allow direct link between my own sites?

I have multiple sites hosted on a Bluehost server. I would like my sites to be able to use the images of others. In other words, I want to let my sites link images together.

There is an option in the Bluehost cPanel to disable active link protection. Turning it off solves the problem. However, I don't want to leave my sites open to links from other people.

I've found out that I'm supposed to add a rule like this to the linked site's .htaccess file:

RewriteCond %{HTTP_REFERER} !^http://example.com/.*$      (NC)
RewriteCond %{HTTP_REFERER} !^http://example.com$      (NC)
RewriteCond %{HTTP_REFERER} !^https://example.com/.*$      (NC)
RewriteCond %{HTTP_REFERER} !^https://example.com$      (NC)
RewriteCond %{HTTP_REFERER} !^http://www.example.com/.*$      (NC)
RewriteCond %{HTTP_REFERER} !^http://www.example.com$      (NC)
RewriteCond %{HTTP_REFERER} !^https://www.example.com/.*$      (NC)
RewriteCond %{HTTP_REFERER} !^https://www.example.com$      (NC)
RewriteRule .*.(jpg|jpeg|gif|png|bmp)$ - (F,NC)

What you are supposed to do is block all direct links except www.example.com. However, it doesn't work, it blocks everything, including requests from www.example.com. I suspect the value of% (HTTP_REFERER) is empty or malformed. Is there a way to check the value of HTTP_REFERER?

.htaccess – [WordPress][htaccess] Prevent unregistered users from accessing pdf, doc, docx, odt files

I have the following code in my htaccess, it works for all users, but I want to deny access only to WordPress users who are not logged in, can anyone help me? Thank you!

RewriteEngine on 
RewriteCond %{HTTP_REFERER} !^http://(www.)?localhost (NC) 
RewriteCond %{HTTP_REFERER} !^http://(www.)?localhost.*$ (NC) 
RewriteRule .(pdf|doc|docx|odt)$ - (F)

I am having difficulty using .htaccess

I am trying to do the link style of my website like this:

^admin/((a-zA-Z0-9)+)$  index.php?usertype=admin&url=$1 (L,QSA)

if there is no administrator I want to use type = user like so:

^((a-zA-Z0-9)+)$ index.php?usertype=user&url=$1 (L,QSA)

Maybe there is a good option, but I am trying to learn.
I did it, usertype = admin works normally but usertype = user doesn't work well: D
here is a link, this link works, but when I go to this link it redirects me to 404 page not found and I did it for a moment, but the css / js files did not arrive, so I got it back

htaccess: what should I do with penalized websites that have been 301 redirected to mine?

You should not reject anything unless you know that those links are causing ranking issues or penalties for their content. In most cases, Google already knows that those domains are spam and completely ignores them. They will not harm your site when your competitor redirects them to you.

If you need to deauthorize, it is unclear whether you can deauthorize the redirect domain or do you need to deauthorize all the domains that bind to the redirect domain. It would certainly be easier to reject redirect domains. Google's John Mueller chimed in on a similar question about redirects and denials, but couldn't really answer it: https://www.youtube.com/watch?v=h0FC1K25Z3w&feature=share&t=28m34s I would start with refusing to redirect the domain and see if that improve the classification or lift the penalty.

In .htaccess you can launch a 403 Forbidden referrer based error. See How do you block a referrer but for a specific URL using .htaccess? Unfortunately, doing so isn't going to help much for two reasons:

  • Googlebot never sends a Referer header, so Googlebot won't know that it's trying to block links.
  • The redirect domain does not always appear in the Referer header. It will only do this for direct traffic to that domain. When someone on page A clicks a link to the redirect domain and is sent to your site, page A appears in the Referer, not the redirect domain.

301 redirect rewrite query string in .htaccess

RewriteRule ^/contact/?view=full$ /contact/ (R=301,L)

the RewriteRule model matches only the URL path, which notably excludes the query string. Therefore, the above directive will not match the required URL. To match the query string, you must use an additional condition and check with QUERY_STRING server variable

Also in .htaccess (directory context) the URL path that matches RewriteRule model does not start with a slash, because the directory prefix is ​​removed first from the matching URL model ends with a forward slash. Then again the directive will not match the requested URL due to the forward slash prefix.

Also, the request query string is copied to the substitution string by default, unless explicitly discard or create a new query string. So the above directive won't remove the query string either.

Try the following instead, near the top of your .htaccess archive:

RewriteCond %{QUERY_STRING} ^view=full$
RewriteRule ^(contact/)$ /$1 (QSD,R=302,L)

This matches the URL /contact/?view=full exactly. And redirect to /contact/. the QSD (Discard query string) indicator (Apache 2.4) in the RewriteRule directive discards the query string of substitution rope.

the $1 is a reference to the group captured in the RewriteRule modelthat is the value contact/. This simply saves typing / repetition.

Note that this is currently a 302 (temporary) redirect. If it is intended to be permanent, only change it to 301 once you have proven it works correctly. The browser caches all 301s persistently, so it can make testing problematic.

You must clear your browser's cache before testing.

Reference:

Deny, Allow in .htaccess does not work

I'm trying to deny all access to wp-login php and grant access to specific public addresses, but it only blocks everyone without granting access to specified addresses

is the configuration used


Order Deny,Allow
Deny from all
Allow from MyPublicIP

Apache .htaccess Redirect and RedirectPermanent directives do nothing

In fact, there is another setting that controls redirects. For Apache to see .htaccess, you need to change the AllowOverrides line in the apache .conf file for the site:


      Options FollowSymLinks MultiViews
      AllowOverride **None**
      Require all granted

You can replace None by Everybody to enable all policies, or by File information if you just want to enable the group of policies that include Redirect. You can read more about the Allow overwrite control in the main Apache guide.