Forum Moderators: phranque
RewriteCond %{HTTPS} =off [OR]Asking because it may depend on something we can't see here - it is commonly written as
RewriteCond %{HTTPS} off [OR]
!^(example\.com)$?is what you want?
!^(example\.com)?$is more common and may be why the tool is gagging?
!^(example\.com)$?
RewriteCond %{HTTP_HOST} !^example\.com RewriteCond %{HTTPS} =off [OR]
Tried the made with love htaccess tester. On this code (it only tests a single redirect).
....[core:alert].... RewriteCond: cannot compile regular expression '^(example\.com)$?'
Lyxx found 1 problem in the code segment below.
The problem was line 6 line 6: (20) RewriteCond %{HTTPS} =off [OR]
The trailing "$" can also be omitted, in order catch FQDN (that end in a dot).In order to catch say-what-now? The usual reason for ending in $ is to exclude requests that come with a gratuitous port number like example.com:443. Is this, too, one of those things that is leveled-out anyway in shared hosting?
The trailing "$" can also be omitted, in order catch FQDN (that end in a dot).
In order to catch say-what-now? .... Is this, too, one of those things that is leveled-out anyway in shared hosting?
FQDN:: detour to abbreviations dot com ::
!^(example\.com)$?This is wrong, and may even result in a 503 error if you try it on a live site. Nothing can come before a ^ anchor or after a $ anchor.
[Fri Aug 23 22:50:21.223202 2019] [core:alert] [pid 13221] [client 75.31.aa.bb:51394] /full/filepath/example.com/.htaccess: RewriteCond: cannot compile regular expression '^(www\\.example\\.com)$?'
Also are you sure that!^(example\.com)$?is what you want?!^(example\.com)?$is more common and may be why the tool is gagging?
1 RewriteRule ^addintheworkplacearticles\.html$ https://example.com/manage-adhd-at-work/ [R=301,L]
This rule was not met.
3 RewriteCond %{HTTP_HOST} ^(example\.com)?$
This rule was not met.
3 RewriteCond %{HTTP_HOST} !^(example\.com)?$
Where it says "The request URL (always starts with an http:// ) I put the old [www...] URL
http:/www.example.com/addintheworkplacearticles.html
I tried changing the order like you suggested but got the same error
Lyxx found 1 problem in the code segment below.
The htaccess tester that seems to have the most feedback is at madewithlove
!^(example\.com)$?
This is wrong, and may even result in a 503 error if you try it on a live site. Nothing can come before a ^ anchor or after a $ anchor."
But then pharnque says I should put the ! in front of the ^(example\.com)?$
"this should be:
3 RewriteCond %{HTTP_HOST} !^(example\.com)?$
"
Which is correct?
^(example\.com)?$ RewriteCond %{HTTP_HOST} !^(example\.com)?$
This rule was not met.
Interestingly I tried reversing the order
I got this result. It got the wrong URL output...
So that seems to tell me that RewriteCond code should be changed ...
I got the “L” flag suggestion from an earlier post from penders
“You don't actually state the URL you are requesting, but if you are requesting "/addintheworkplacearticles.html" (as suggested by the output) then that is correct - only the first directive will be "tested" and processing stops (because of the "L" flag)."