问题
Since I'm new to Joomla I would like to know whether there is a way to change the administrator URL by using PHP rather than using a plugin or extensions. As far as I see using a 3rd party component is risky. I really don't want to use 3rd party extensions at all in mysite. How can I get it done?
By default Joomla administrator URL is yoursitename/administrator.
changing constants in /includes/defines.php and /administrator/includes/defines.php does not work.
Thanks
回答1:
referring this post you have got two options one through cpanel and other to use .htaccess..
回答2:
From what I have read, you can't change the administrator URL however someone did post something regarding it on Stackoverflow.
Open the following files:
/includes/defines.php >> line 25
/administrator/includes/defines.php >> line 21
Else the only way might be using an extension.
回答3:
Step 1. Create a new directory in your root directory (eg. "newadminurl")
Step 2. Create an index.php file in your "newadminurl " directory..
$admin_cookie_code="3429020892";
setcookie("JoomlaAdminSession",$admin_cookie_code,0,"/");
header("Location: /administrator/index.php");
?>
Step 3. Add this to .htaccess of your real Joomla administrator directory
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/administrator
RewriteCond %{HTTP_COOKIE} !JoomlaAdminSession=3429020892
RewriteRule .* - [L,F]
Explanation:
Now, you need to open "http://yoursite.com/newadminurl/" before you open your “administrator” path. Here we have created a cookie that expires at the end of the session and redirect to actual administration page. Your actual “administrator”path is inaccessible until you don’t open on your secret link .
I hope this is what you are looking for.
来源:https://stackoverflow.com/questions/13138164/how-can-i-change-the-joomla-administrator-url-by-php-no-plugins