Reputation: 560
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
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
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