Mv27
Mv27

Reputation: 560

htaccess gives 403 except own ip-address

I am trying to make a 301 redirect from an old website to the new website - both are Wordpress. I would like that everyone is redirect except my own ip-address.

Everytime I add my code to the .htaccess file I can access the site from my own ip-address, but everyone else is getting a 403 error.

I cannot figure out why? Can somebody help me out?

    # 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

//Rewrite to www
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^olddomain.dk/[nc]
RewriteRule ^(.*)$ http://www.olddomain.dk//$1 [r=301,nc]

//301 Redirect Entire Directory
RedirectMatch 301 /olddomain.dk/(.*) /newdomain.dk//$1

//Block users by IP
order allow,deny
deny from 
allow from 12.345.67.890

Upvotes: 0

Views: 145

Answers (1)

user6076417
user6076417

Reputation:

try to change: deny access to your website for everyone except you.

Order deny,allow
Deny from all
Allow from 12.345.67.890


or try this (using mod_rewrite):

RewriteEngine On
RewriteCond %{HTTP_HOST} olddomain\.dk [NC]
RewriteCond %{REMOTE_ADDR} !12\.345\.67\.890
RewriteRule (.*) http://newdomain.dk/$1 [R=301,L]

Upvotes: 1

Related Questions