Solved Subdomain Folder is Case Sensitive

AfterInfinity

Verified User
Joined
Jul 16, 2021
Messages
16
Hey there!

I'm scratching my head on this one and I know I shouldn't as the solution is probably very easy.
I've created a subdomain called autodiscover and by default DirectAdmin creates a folder in the domain's public_html folder with the subdomain's name.
This is good in my situtation as I want the php file to be accessible from autodiscover.domain.tld/autodiscover.php and also from domain.tld/autodiscover/autodiscover.php

Just a note: I have a .htaccess in the subdomain's folder that makes any request result in example.php being called.
Apache config:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ autodiscover.php [NC,L]

What isn't going as planned is the case sensitivity.
When accessing the php file from autodiscover.domain.tld all goes well. Whatever I input after autodiscover.domain.tld/xxxx, uppercase or lower case doesn't matter, it results in autodiscover.php being loaded.
The issue rises when accessing the php file from domain.tld/autodiscover/. If I capitalize any of the letters in domain.tld/autodiscover/. Say for example domain.tld/Autodiscover/ a 404 Error page loads.

Do any clever minds here know how to make the subdomains folder case insensitive?

Kind Regards! :)
 
This maybe helps?

the problem is that rewrite rules ARE case sensitive. So your Rewrite rule should be:

RewriteRule ^[Bb]log/(.*?)$ /Me/profile.php?username=$1 [QSA,L]
For Blog and blog
and voila you are fixed.
 
Last edited:
This maybe helps?


For Blog and blog
Hello Ikkeben! Thank you for your suggestion. I've tried to use this rule but unfortunately it doesn't work and I can't understand why.
Should I maybe change the openlitespeed.conf to tell it to be case-insensitive with the ./autodiscover/ directory specifically?
 
I have finally solved the problem. Or I think I did. Time will tell, haha.

For anyone who's interested:
Yes the solution was to change the openlitespeed.conf.
Changing the file directly will not make the changes permanent, so this had to be done through DirectAdmin GUI.

Navigating to HTTPD Custom Configuration I selected the domain's openlitespeed.conf.
Thereafter (in evo skin) a button called customize will appear next to the openlitespeed.conf.
When the button is pressed there are 8 different "CUSTOM" areas you can edit.
I selected "CUSTOM 5" which adds code in the rewrite section.
Under it you will see a text box where you can enter the code.
Keep in mind this changes all the vhost rewrite sections in the file.
If anyone know how to just add the code in just one or two vhosts please reach out to me in this thread.

Anyway, in this text box I added these lines:
Apache config:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?autodiscover/(.*)$ autodiscover/$1 [NC,L]
example being the subdomain.

My sources: OpenLiteSpeed - Rewrite rule difference in .htaccess vs VH rewrite tab vs VH context rewrite rules

Kind Regards
 
Back
Top