New answers tagged

1

You've put your "redirect" directives in the wrong place - they need to go at the top of the file, before the # BEGIN WordPress section. By placing them later in the file (after the WP front-controller) then they are only going to get processed for requests that map directly to physical files and directories (which includes the document root). So, ...


2

There's nothing in the directives you've posted that would cause this directly. Throwing a regex at this isn't going help. The RewriteRule directive you posted redirects to http - end of. So, any "redirect" to HTTPS is coming from somewhere else. You need to examine the HTTP request/response headers in the browser. Are you actually seeing a 3xx ...


1

ErrorDocument 404 https://doamin.com/error.php You need to use a root-relative URL-path, not an absolute URL in the ErrorDocument directive. If you specify an absolute URL then it will trigger a 302 redirect to the error document (and a 200 OK response when the error document is served) and consequently, any information about the request that caused the ...


0

This does redirect: RewriteCond "www.%{ENV:DOMAIN_NAME}" "!=%{HTTP_HOST}" Because server variables of the form %{VARNAME} are not expanded in the CondPattern (2nd argument to the RewriteCond directive). You are comparing against the literal string "%{HTTP_HOST}", which is obviously different to "www.localhost.com", so ...


2

This is technically possible, however, there is another "preferred" solution for "a CMS with a public folder and a private folder" (see below). To summarise the requirements: Allow requests for /private/ or /private/<something> (where <something> is not a physical file in the /private subdirectory) to be routable through the ...


0

Meanwhile I found a subject on stackoverflow: https://stackoverflow.com/questions/5799906/what-s-the-difference-between-expires-and-cache-control-headers There, one user also gives a link to w3: https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html which says: If a response includes both an Expires header and a max-age directive, the max-age directive ...


1

I played around with this a bit, and I don't believe it is possible - at least not in the main .htaccess file without messing with server limits. I posit it may be possible to override the default behaviour by modifying the apache configuration file. It might make sense to move your private configuration above your document root (I assume you are using it to ...


1

ExpiresByType image/jpg "access 2 years" First... to clarify, this should probably be image/jpeg, not image/jpg. image/jpeg is the official mime-type for JPEG files. Check the Content-Type HTTP response header associated with this response. For instance, if your server is sending JPEG files with a image/jpeg mime-type (as it should be), then the ...


1

But, what are the file types that ExpiresDefault will work on ? As you've stated, "the rest". Any responses that are not covered by the mime-types stated in the preceding ExpiresByType directives are covered by the ExpiresDefault directive. So, from the directives you posted, this will include HTML (text/html), JS (application/javascript), CSS (...


1

These two directives are the same. The plus keyword is entirely optional. It is just syntactic sugar, to make it (arguably) more "readable". As stated in the Apache docs for mod_expires: ExpiresByType type/encoding "base[plus num type] [num type] ..." : The plus keyword is optional. So, include it or not - it is up to you. But, as with ...


2

As per https://developers.google.com/search/reference/robots_txt "The robots.txt file must be in the top-level directory of the host" so the instance in the subdirectory will not be read and be of no affect. Likewise, .htaccess files only apply to the directory they are in and their children - thus the .htaccess file in the subdirectory copy will ...


Top 50 recent answers are included