Hot answers tagged

2

Your RewriteCond is incidentally valid but fundamentally wrong. For the URL https://example.com/?amp=1, the characters /? are not part of the %{QUERY_STRING} value, which is amp=1 in fact. I said 'incidentally valid' because in your regex, / is neutralized by ?, so there is a match with amp=1. To achieve your goal, in the simplest case, especially without ...


2

I fear from the phrasing of your question that you might be unaware of the very substantial security implications. Don't do this lightly on an Internet facing server. There are a few ways of doing this. The "Apache level" way is to set up "cgi" functionality in Apache. One way to do this us to add a stanza like below to your Apache config:...


2

There's no magic bullet here, if you are blocking "bad bots" based on the User-Agent string then you need to match on a sufficiently unique substring as to not conflict with other bots and users. But will such an approach unintentionally block good ones as well? Not if you've chosen a sufficiently unique substring to match against. HOWEVER, "...


1

What is "duplicate content"? "Duplicate content" is simply where you have two or more different URLs referencing essentially the same resource and are not canonicalising this in some way (eg. with a rel="canonical" element or external redirect). https://example.com/foo/bar and https://www.example.com/foo/bar are two different ...


1

There are three parts to this: Making URLs without an extension work by loading the correct content Redirecting URLs ending in .html to remove the extension Changing all the links in your site so that they don't have the .html The first part is built into the Apache content negotiation module. It has a feature called "Multiviews." That feature ...


1

There is no single answer to this and any way you attack it will likely cause significant pain during the transition. I would focus on the problem you are issue you are trying to solve, rather then ask for how to implement a specific solution. Some possibilities - Use rewrite rules to add .html onto the end of any url received [that doesn't end in .xx .xxx ...


1

Your RewriteRule applied to http://example.org/about/ redirects to http://example.org/var/www/example/public_html/about/.php and result in a 404 Not Found response. /var/www/example/public_html, or something similar, is the absolute path of the directory that contains the files of the website on the server. This type of path shows up because you did not ...


1

All I know is that on Apache 2.4 on CentOS 7, the leading slash is required in a VHost but is forbidden in .htaccess VHost: <VirtualHost *:443> ServerName supersite-cms.example.com # Forward cms requests to the subsite # Note the RewriteRule syntax is different than in .htaccess :| RewriteEngine on RewriteRule ^/subsite/admin$ https://...


Only top voted, non community-wiki answers of a minimum length are eligible