I have around 10 Joomla websites hosted on Apache server. The admin URLs are similar to below patterns.


Common pattern can be identified as,

http://[one letter & digits].[two letters].example.com/administrator

The part example.com/administrator remain unchanged.

I need to redirect users to relevant home page of each Joomla website if users try to go to URL with above pattern.

What I did so far :-

Add below directive in httpd.conf file

<IfModule alias_module>
  Redirect permanent /(\.)[a-z]*\/administrator /(\.)[a-z]*  

However this is not working. Can someone give a solution for this?

  • Whenever you require a well-crafted regular expression, you should provide at least 3 very realistic sample strings. The more realistic the samples and the more samples that you provide, the more accurate the pattern can be. A dot doesn't need to be wrapped in parentheses. Oct 29, 2019 at 11:47
  • What do you want to do with the user that has to access /administrator to maintain the site? Or why are you trying to redirect people to the homepage, is it a security issue? There are some plugins that do the redirect for you that I could suggest if I understood more about your requirement.
    – Irata
    Oct 29, 2019 at 12:25
  • @mickmackusa please check the edit.
    – user27
    Oct 29, 2019 at 15:28
  • @Irata I'm going to evaluate set of users on their Joomla knowledge and had given a deadline to create Joomla websites. So after the deadline users should not be able to access admin to do any changes. considering this scenario can you give me a solution? Also the number of Joomla websites can increase. So I will need a solution which can be applied to all the Joomla sites in the server.
    – user27
    Oct 29, 2019 at 15:41
  • Redirecting isn't really my bag, but if you only mean to trim the administrator off, shouldn't this work? Redirect permanent /(\.[a-z]*)\/administrator $1 A good place to test patterns: regex101.com/r/DRGLAV/1 Or maybe you mean to grab the whole domain before .com which could be loosely done with .+ regex101.com/r/DRGLAV/2 . Oct 29, 2019 at 20:00


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.