Remove ServerAlias from httpd.conf - apache

I am using WHM/cPanel to manage web hosting and wondering how to remove the "cpanel, whm, webmail" ServerAlias. For example, I DO NOT want anyone to do this {HTTP_HOST}/cpanel in order to get to their cPanel.
These rules are clearly defined in the httd.conf file which is located in
/usr/local/apache/conf
I have already tried to manually modify them and I got the following message:
# DO NOT EDIT. AUTOMATICALLY GENERATED. IF YOU NEED TO MAKE A CHANGE
PLEASE USE THE INCLUDE FILES.
Nothing really happened even though the file was successfully saved. Users are still able to use these unwanted aliases. What should I do to effectively make the change?

Have you restarted Apache?
service httpd graceful
.. or you can do it through WHM.

Related

Using same Directory directive for multiple virtual hosts with custom conf files

We have a SaaS product and we give websites for customers. The customers can request to have their own domain pointed to their website. At the moment we use httpd.conf file to add a VirtualHost entry pointing to the same document directory. Afterwards the database will load the website by matching the URL. We have CentOS installed.
I think this is quite risky because if there is a mistake in httpd.conf file their is potential the whole product might not work. This has actually happen. Also, we use WHM and cPanel, so when we add a mod or does a server tweak the entire httpd.conf gets rewritten having us to replace/add existing virtual host entries to the file.
I will need a solution where i can add VirtualHost entries in a separate conf file or multiple conf files and load them via httpd.conf file which should automatically pick the newly added file/files without having to restart the server.
Can someone point me in the right direction where i can achieve the above.
Cheers!
You dont need to restart, just reload

Contao is redirecting to non existend development subdirectory

Im currently trying to move a website to production that has been designed using contao. The website has been developed in a subdirectory of the current website. Now when I change the DocumentRoot to the contao directory the application automatically forwards me to the /development directory which in that situation does not exist anymore.
I did a database dump and searched it for "/development" to find the variable that is storing this information but I didn't find a match. I then did the same with the configuration files but it didn't show up any results too. How is redirecting handeled in contao?
It sounds like your pathconfig.php is wrong. After deploying/moving a Contao installation, you should always execute and log into the Install Tool under contao/install.php. This will correct your pathconfig.php.
Also make sure the RewriteBase in the .htaccess is set to the correct value (probably / in your case).

Modifying Apache httpd.conf file via C-Panel

I had my websites set up so that if someone types in a URL with upper case letters and/or underscores, like this - MySite/topics/United_States - it will automatically default to mysite/topics/united-states (lower case and dashes instead of underscores).
I've been through some website crashes, moves and reorganization, and I just discovered this feature is no longer working. I haven't been able to access my online httpd.conf file.
However, I think I discovered a way to do it with C-Panel...
Service Configuration > Apache Configuration > Include Editor > Post VirtualHost Include
"Entering information in this text area will add content to the Apache configuration file (httpd.conf) right after the last VirtualHost entry.
"I wish to edit the Post VirtualHost configuration include file for:"
I selected 2.4.18, and it opens a box where I can type in my code. Above the box it says Filename: post_virtualhost_2.con
And this is the code I want to paste in the box:
RewriteRule (.?[A-Z]+.) /${tolower:$1} [R]
Which brings me to my question. Before I do this I want to make sure I'm not doing something that's going to wreck my site. Does it sound like I'm doing this the right way? And if I somehow mess up this file or paste in the wrong code, how can I fix it?
Have you tried to use this rewrite rule in the .htaccess file of a single cPanel account on the server and test it? It will cause a lot less damage in case it does not work and will be easier to revert (just delete the line).
Please make sure that if you add it in an .htaccess, you also start with:
RewriteEngine On
and then add your rewrite rule.
If you decide to go and edit the global Apache configuration, you should log in the server via SSH and make a copy of the file you are editing:
/usr/local/apache/conf/includes/post_virtualhost_2.conf
If this breaks your site, you can just restore the original file or remove the changes you made and restart Apache, this should fix it.

Apache httpd.conf change without restart the server

According to my client requirement every time a user register to software we need to provide a separate URL. For that we are using apache and registering the new url in apache httpd.conf. Now the issue is after every new url entry we need to restart the apache server to reflect the changes. But this approach is bad because restarting the apache server also effecting the existing client. So, I would like to reflect the changes without restarting.
So, an any one help me to do that with apache.
I am also open for other tools if that can solve my issue.
Apache can't update it's configuration without restart (graceful or clean).
It's a bad idea to store generated URLs in Apache config.
Much better is to use rewrite maps or store URLs in database and rewrite them with mod_rewrite

HTTP sources with h5ai appear empty in XBMC

I'm having some trouble adding a custom source to my XBMC set up. I've got an Apache2 server up and running that I use to stream movies to my computer and would like to include it as a source in XBMC. I'm no web server expert, but I managed to get h5ai style indexing on my server, which I'd like to keep. The problem is that when h5ai is enabled, XBMC can't locate any of the files. With h5ai disabled I have no issue browsing through my files.
The obvious solution is to keep h5ai off, but since I use my server outside of XBMC, I'd like to find a way to keep it on. I'm very new when it comes to web servers, so it's very possible I'm just doing something wrong. I merely followed the instructions of placing the _h5ai folder in my path and editing .htaccess. If anyone could shed some light on the issue (solution or simply an explanation) I would greatly appreciate it.
Additional info: I'm running XBMC 12.0. My server is a rented seedbox, so I have no root privileges.
Easiest solution is making a subdirectory specifically for XBMC and adding a .htaccess file that keeps h5ai indexing out of it:
DirectoryIndex index.html
Then have the HTTP source include the full path to said subdirectory.
I had the same issue and fixed it by removing "IndexOptions IconsAreLinks" from .htaccess