Home › Forums › BulletProof Security Free › Redirect WordPress Website and Still Allow Login
Tagged: Allow Login, Redirect WordPress, wp-admin
- This topic has 25 replies, 4 voices, and was last updated 3 years, 10 months ago by
Alex Laxton.
-
AuthorPosts
-
Rick
ParticipantWell the status bar on Firefox lower left hand corner shows when connecting or when the browser is connecting with a website in general. It keeps looping to find the new domain name while the WordPress dashboard is being used… it just slows things down quite a bit. Every time you navigate within the dashboard of the old domain it keeps trying to reference the new domain.
AITpro Admin
KeymasterWow that is strange since the .htaccess condition says do not do anything when the URI/URL is /wp-admin/. That issue did not occur on our testing website using Google Chrome. The only logical explanations that I can think of would be a cache issue – either Browser or plugin cache, some sort of Cloud/CDN/Proxy issue, a plugin or theme on this site is doing something unusual or there is a DNS record created for this Domain that is doing something like forwarding or aliasing.
Rick
ParticipantOk, here is another problem with this. I am finding out that I am able to visit pages that were created on the OLD WordPress Domain with this redirect you gave me. The main domain oldsite.com redirects fine to the newsite.com but the individual pages on the OLD WordPress are not redirecting me. Any solution?
AITpro Admin
Keymaster# RedirectMatch dynamic URL redirect with matching URL structures RedirectMatch 301 ^/([^/]+)/([^/.]+)$ http://newsite.com/$1/$2/ RedirectMatch 301 ^/([^/]+)/([^/]+)/([^/.]+)$ http://newsite.com/$1/$2/$3/ # mod_rewrite Host name based dynamic URL structure rewrite RewriteCond %{HTTP_HOST} sitename.com [NC] RewriteRule ^([^/]+)/([^/]+)/([^/.]+)$ http://newsite.com/$1/$2/$3/ [R=301,L] # RedirectMatch individual URL redirects to new site RedirectMatch 301 ^/some-url/$ http://newsite.com/$ RedirectMatch 301 ^/some-other-url/$ http://newsite.com/$ # Simple RedirectMatch individual URL redirects to new site RedirectMatch 301 ^/some-url/$ http://newsite.com/some-url-different-name/ RedirectMatch 301 ^/some-other-url/$ http://newsite.com/some-url-another-different-name/ # WP REWRITE LOOP START RewriteEngine On RewriteBase /wordpress-testing-website/ RewriteCond %{REQUEST_URI} !^(/wp-admin|.*wp-login\.php.*) [NC] RewriteRule (.*) http://www.ait-pro.com/$1 [R=301,L] # WP REWRITE LOOP END
AITpro Admin
KeymasterBut actually if your URL structure is identical on both the old site and the new site then this code below works fine without doing anything else or adding any additional code in your root .htaccess file on the old site. If your URL structure is not the same then what happens is the backreference $ will rewrite the URL name of a post on the old site to the new site.
Example: oldsite/post-10 with rewrite to the new site as this: newsite/post-10. If the URL /post-10 does not actually exist on the newsite then a 404 error will occur on the newsite.
If this code is not working on your site correctly then there is a mistake somewhere.
# WP REWRITE LOOP START RewriteEngine On RewriteBase /wordpress-testing-website/ RewriteCond %{REQUEST_URI} !^(/wp-admin|.*wp-login\.php.*) [NC] RewriteRule (.*) http://www.ait-pro.com/$1 [R=301,L] # WP REWRITE LOOP END
AITpro Admin
Keymaster[Topic manually moved to this relevant Topic]
Hello again! The security of BPS is amazing… Makes life very challenging, even for the administrator of the site 🙂 So, I have everything working perfectly, thank you for that.
As per your reply regarding access to the wp-admin section, I have tried to add the code but it will not update. BPS is totally blocking access. I have tried editing the htaccess file, directly on the server but it will not update. I have tried editing the htaccess locally, then when I try to upload to the server again with FTP, it gives me the following error:
Command: STOR .htaccess
Response: 553 Can’t open that file: Permission denied
Error: Critical file transfer errorHow can I get around this? I need to get back in there so that I can get it all set up properly for my webmaster tools account and complete this domain transfer.
Thank you,
DaveAITpro Admin
KeymasterBPS does not block access to itself. The redirect code that you added in your other forum topic to redirect your old site to your new site is doing what it is supposed to do. The reason you are unable to edit, modify or upload a new htaccess file is that your htaccess file is locked with 404 file permissions. You would need to unlock it with 644 file permissions. In other words, change the file permissions of the htaccess file from 404 file permissions to 644 file permissions.
Glutathione.MD
ParticipantOk, thank you, I was able to edit and load the htaccess file.
I still cannot access the login page though. Is there something wrong with how this is set up?
# CUSTOM CODE BOTTOM HOTLINKING/FORBID COMMENT SPAMMERS/BLOCK BOTS/BLOCK IP/REDIRECT CODE # WP REWRITE LOOP START RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} !^(/wp-admin|.*wp-login\.php.*) [NC] RewriteRule (.*) http://immunocal.md/$1 [R=301,L] # WP REWRITE LOOP END RedirectMatch 301 ^/immunocal.science\.php$ http://immunocal.md/science/ RedirectMatch 301 ^/immunocal.science\.html$ http://immunocal.md/science/ RedirectMatch 301 ^/immunocal.and.breast_cancer\.php$ http://immunocal.md/breast-cancer/ RedirectMatch 301 ^/immunocal.and.lung_cancer\.php$ http://immunocal.md/lung-cancer/ RedirectMatch 301 ^/immunocal.and.skin_cancer\.php$ http://immunocal.md/cancer/
As you can see, the code is before the other redirects (these are the old redirects) and at the bottom of the list is the final redirect you gave me yesterday, which takes all the old pages to the new site.
What did I do wrong?
Thanks,
DaveAITpro Admin
KeymasterOh well it was worth a shot. That code does not work on all host servers. It works perfectly on my host Go Daddy. Unfortunately, you will not be able to login to the backend of your old website using that code and the WordPress login.
Glutathione.MD
ParticipantNo problem, thanks again for all your help and your awesome plugin!
Dave
Alex Laxton
ParticipantJust replace the domain name where you want to redirect its a small issue, don’t worry you have got a solution from here if you don’t get then you will get from Google or by another way.
-
AuthorPosts
- You must be logged in to reply to this topic.