New answers tagged

2

You can use the ProxyPassMatch directive like this: ProxyPassMatch /([^/]*)/(.*)$ https://$1.example.com/$2 However, you will get partial results. The proxy part will work, however, the cookie path will be different: as you request /host1, and the backend server sets cookies to /, this can lead to problems. Also, redirects aren't handled properly: if the ...


1

I just had the same issue - I resolved it by using RewriteOptions InheritBefore instead of just RewriteOptions Inherit so the .htaccess file in the parent directory was processed before the one in the sub-directory


1

RewriteCond %{QUERY_STRING} p=(.*) RewriteRule ^(.*)/p=$ $1?page=%{QUERY_STRING} [L,QSA] There are numerous "errors" here: The RewriteRule pattern, ie. ^(.*)/p=$, will never match because p= does not occur as part of the URL-path (it is part of the query string). The RewriteRule pattern matches against the URL-path only, which notably excludes ...


1

Thanks to @MrWhite in the comments, on Centos I discovered a file called /etc/httpd/conf.d/welcome.conf which contains: <LocationMatch "^/+$"> Options -Indexes ErrorDocument 403 /.noindex.html </LocationMatch> Since there is no file called .noindex.html the 403 error document itself was triggering an internal 404 error. ...


1

I can only assume this is some conflict with WordPress's mod_rewrite rule It actually looks like the opposite is happening. Only when you request https://wordpress-test-site.com/<something> do the mod_rewrite directives actually do anything. When you request the document root, then the mod_rewrite directives simply don't match and instead the request ...


0

DocumentRoot /var/www/test/public_html <Directory /vaw/www/test/public_html> As noted in comments, a typo in the file-path specified in the <Directory> directive seems to have been the problem. /vaw/ should have been /var/ to match the DocumentRoot. With an incorrect file-path the <Directory> section would have simply been ignored.


0

RewriteMap hosts-allow txt:/conf/hosts-allow RewriteCond "${hosts-allow:%{HTTP:X-REAL-IP}|NOT-FOUND}" "=NOT-FOUND" RewriteRule ^/login/.* - [R] There are a few issues here... The X-REAL-IP is unlikely to be set unless you are behind some kind of proxy server. However, X-REAL-IP is non-standard, so unless you specifically know this is ...


2

Solution RewriteRules must use \x instead of % in order to match %-encoded URLs! (PCRE syntax for byte sequences) mod_rewrite-config uses PCRE regex syntax, and operates on decoded URLs, so typing a %-encoding in a RewriteRule pattern causes it to look for the literal %-character, not an encoded value. The correct escape-character in RewriteRules is \x, so ...


Top 50 recent answers are included