Forum Moderators: phranque
RewriteCond %{REMOTE_ADDR} !^11\.222\.33\.444
Redirect 307 /index.php http://example.dk/backupall/index.htm
RewriteEngine On
RewriteCond %{REMOTE_ADDR} !^11\.222\.33\.444
RewriteCond %{REQUEST_URI} /reset-pageviews [NC]
RewriteRule .* index.php [F,L]
[edited by: phranque at 1:11 am (utc) on Feb 19, 2019]
[edit reason] anonimize IP [/edit]
How can you tell? Unless this is the very last mod_rewrite-related utterance in your htaccess, this RewriteCond will be read as belonging to the next RewriteRule, no matter how far away it is. What rule does it belong to?Only gives a 500 server error.RewriteCond %{REMOTE_ADDR} !^11\.222\.33\.444
RewriteCond %{REMOTE_ADDR} !^11\.222\.33\.444
RewriteCond %{REQUEST_URI} /reset-pageviews [NC]
RewriteRule .* index.php [F,L]
RewriteCond %{REMOTE_ADDR} !^11\.222\.33\.444$
RewriteRule ^reset-pageviews$ - [F] [edited by: phranque at 1:39 pm (utc) on Feb 19, 2019]
[edit reason] exemplified domain [/edit]
That's why I somehow need an exception in the redirection when the request comes from me.You need to get rid of the mod_alias redirect cited in your first post--the one that begins “Redirect 307”--and change it to mod_rewrite syntax. Only mod_rewrite can recognize the RewriteCond that is an essential part of the rule.
Redirect 307 /index.php http://example.dk/backupall/index.htm RewriteCond %{REMOTE_ADDR} !^11\.222\.33\.444$
RewriteRule .? http://example.dk/backupall/index.htm [R=307,L]Functionally there is no difference between .? and .* in the pattern. It just saves the server a picosecond because it doesn't have to gobble up the whole request. Some people like to use the anchor ^ by itself instead. In any case, this bit simply means “there was a request”. The closing anchor in the Condition is only essential if the last piece of your own IP has only 1 or--maybe--2 digits. Otherwise it doesn’t matter. when I try to open a page in the wp editor, it cant loading because it gets redirected
That's why I somehow need an exception in the redirection when the request comes from me.
http://example.dk/backupall/index.htm
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress