Change Backoffice Directory Name

Changing the Backoffice (oc-admin) Directory Name

Osclass allows administrators to change the name of the oc-admin directory to enhance security and obscure the CMS being used. This feature has been available since Osclass version 8.0. Changing the backoffice folder name can help in the following scenarios:

  • Security – Prevents unauthorized visitors from easily locating the admin panel.
  • Masking – Hides the fact that Osclass is being used as the CMS.

Steps to Change the Backoffice Folder Name

1. Rename the oc-admin Directory

Access your file system via FTP, SFTP, or a file manager in your hosting panel. Locate the oc-admin folder in the root directory of your Osclass installation and rename it to a new, difficult-to-guess name (e.g., xa1fsade8).

2. Update the Configuration File

After renaming the folder, you need to inform Osclass about the new name. Open the config.php file located in the root directory of your Osclass installation and add the following line at the bottom:

define('OC_ADMIN_FOLDER', 'xa1fsade8');

Replace xa1fsade8 with your new backoffice directory name. Save and close the file.

3. Access Your New Admin Panel URL

After making these changes, you can access your backoffice using the new directory name:

https://yourdomain.com/xa1fsade8/

If your Osclass installation is in a subdirectory, the new login URL would be:

https://yourdomain.com/subdirectory/xa1fsade8/

Plugin Compatibility Considerations

Some older plugins may use a hardcoded oc-admin path in their URLs, which can cause issues accessing their configuration pages. If you encounter this issue, you have two options:

1. Manually Update the URL in the Browser

When attempting to access a plugin’s settings page, if the URL still contains oc-admin, manually replace it in your browser’s address bar with your new backoffice directory name.

2. Modify Plugin Files

To permanently fix the issue, modify the plugin’s files to use the correct admin URL dynamically. Locate the index.php file in the plugin directory (or any file that generates admin links) and replace hardcoded URLs with the following function:

<?php echo osc_admin_base_url(true); ?>

This function dynamically generates the correct admin panel URL, ensuring compatibility even if the backoffice folder name is changed.

Conclusion

Renaming the oc-admin folder is an effective way to enhance security and obscure your Osclass installation. However, be mindful of plugin compatibility and update your configuration files accordingly. If any plugin stops working due to this change, updating its URLs to use osc_admin_base_url(true); will resolve the issue.