Change “wp-admin” URL Without Plugin
Changing the default WordPress login URL from "wp-admin" to a custom URL is a proactive security measure that helps safeguard your site against potential threats.
"There are tons of 3rd party plugin to do it but remember they may slow down your website also may cause security threat."
1. Backup Your WordPress Site
Before making any changes, create a full backup of your WordPress site, including the database and files.
2. Create a Child Theme. Skip if you already have.
Follow the steps in the article How to Create a WordPress Child Theme to create a child theme for your active WordPress theme.
Child theme will safeguard all your custom changes when update parent theme.
By creating a child theme, you maintain a clean separation between your customizations and the parent theme, making it easier to manage and update your site in the long run.
3. Access Your Child Theme Files
Use an FTP client or your hosting file manager to navigate to the directory of your child theme. This is typically located at wp-content/themes/your-child-theme-name/
.
4. Edit the functions.php File in the Child Theme
Add the following code to the functions.php
file of your child theme:
// Change login URL
function custom_login_url() {
return home_url('/your-custom-url');
}
add_filter('login_headerurl', 'custom_login_url');
Replace /your-custom-url
with your desired custom login URL.
Save the changes in modified functions.php
file.
5. Edit the .htaccess File
Edit the .htaccess
file in the root directory of your WordPress installation. Add the following lines at the beginning of the file:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^your-custom-url/?$ wp-login.php [L]
</IfModule>
Replace your-custom-url
with the same custom login URL you specified in the child theme's functions.php
file.
Save the changes in modified .htaccess
file.
6. Test the New Login URL
Visit your custom login URL (e.g., https://yoursite.com/your-custom-url
) to ensure that the new login page loads correctly. Also, test the login/logout processes, password recovery, and any custom functionality.
7. Update Permalinks
As a good practice, go to "Settings" > "Permalinks" set post name as permalink in your WordPress admin dashboard and click "Save Changes" to update your site's permalinks.
8. Clear Cache
Clear your browser cache and refresh the login page.
Related Posts
How to change featured image size in WordPress?
The size of a featured image depends on several factors, such as the theme, layout, and design of your WordPress site, as well as the dimensions and quality of the original image. However, a good starting point for your WordPress featured image size is 1200 x 628 pixels. These dimensions tend to work well across…
How to Add a Go Back to Previous Page Button in WordPress (2 Easy Methods)
In this tutorial, I will guide you through the process of adding a “Back to Previous Page” or ” Go Back” button using ElementorThis site use affiliate links to promote recommended product and services and Gutenberg/ Block Editor. Hey to make thing easier I just created a WordPress plugin, by using it you can easily…
How to Duplicate Posts and Pages Without Plugin in WordPress
Duplicating existing content can save you time and effort, allowing you to quickly create new variations of page, post or landing page without starting from scratch. While WordPress doesn’t have a built-in duplicate feature, you can easily add this functionality using a simple code snippet. Here’s a step-by-step guide: 1. Open the Theme Editor: Note:…
Customize WordPress Login Page Manually
We’ll guide you through the process of customizing or rebranding your WordPress login page without any additional plugins. 1. Access your WordPress Files Use FTP (File Transfer Protocol) or cPanel to access your WordPress installation directory. 2. Creating a Child Theme for Safe Customization In the “wp-content/themes/” directory, create a new folder for your child…
Google Warns Against URLs with Double Slashes [Solved] – 2024
Have you ever come across URLs with double slashes, like “http://www.example.com/path//index.html,” and wondered what causes this & whether it impacts your website’s SEO? And the answer is big YES! In this article, we’ll delve into the reasons behind double slashes in URLs, their potential consequences, and how to solve them for a smoother user experience…
How to Create Sitemap Manually for WordPress: Ultimate Guide
Key Takeaways: A well-structured XML sitemap is a cornerstone of effective SEO for WordPress websites. In this comprehensive guide, we’ll walk you through every steps creating a robust XML sitemap manually without relying on plugins. We’ll cover sitemap for posts, pages, categories, and authors, enhancing search engine understanding and optimizing your site’s visibility. Step 1:…