New answers tagged

1

For changing the main/primary domain, you will need to have root SSH access and be able to locate and edit the following file (replacing your user & domain info): /var/cpanel/userdata/USERNAME/DOMAIN.COM Once you have opened the file, look for the following line: documentroot: /home/USERNAME/public_html Modify the location according to your needs. ...


0

My only other thought is to try a rewrite rule in Apache - but a conditional one. : Is this possible? Unfortunately not. The user sees the certificate error long before the request hits your server-side code. The only way to fix a certificate error is to fix the certificate. If this was not the case then security could be bypassed. the problem ...


3

I'm guessing you are not only looking into how you can download A file, but also concerned about how to do that for every file in a specific folder on the server without having to change the link itself on every page. If you have write access to the folder where the files are (download) and to the web server, you could add an .htaccess in that folder with a ...


1

Can html go in the ErrorDocument value internally in httpd.conf? Yes. HTML is just text and Apache appears to send this with a Content-Type: text/html header by default anyway. So, when this "text" hits the browser the browser renders it as HTML, even when sending a simple string of text. ...would apache accept html as text? As stated above, HTML ...


2

Server side: Add this to your .htaccess file: AddType application/octet-stream .pdf Client-side: It is simple and it consists in using the HTML5 download attribute. This works both with images and pdf files as you requested. Example: <a href="http://example.com/downloads/pdf/example.pdf" download> Download</a> In the same way, you can ...


2

How can I tell the sever... You are "telling" the browser (user-agent), not the server. You basically need to send the appropriate HTTP response headers. Specifically the Content-Disposition and possibly the Content-Length headers. For example: Content-Disposition: attachment; filename=example.pdf Content-Length: 8809 The filename argument is ...


2

All of these files which are being checked for including the /\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd which you mention in your last comment are attempts by attackers to identify common files which can be vulnerable in your web root which on a mis-configured website can provide an attacker the information they need to penetrate your site. As an ...


4

Server version: Apache/2.4.12 (Win32) Is it possible to make website a variable? Not before Apache 2.4.13 unfortunately. Can .htaccess auto detect the SubFolder (including SubFolder depth)? This depends on the module you are using in .htaccess, rather than .htaccess itself. For instance, mod_rewrite (when used in a per-directory context) ...


3

People often forget about using symlinks. You can create a symlink for each site that points to a single directory. This means that a relative URI of /error/error404.html can all point to the same directory/file even outside of the/any web root. This answer on another SE site covers the topic enough to get started: ...


1

As far as I know, Apache universally uses Perl Compatible Regular Expressions (PCRE). This is stated in the Apache glossary under Regular Expressions. mod_rewrite certainly uses PCRE (as stated in the mod_rewrite docs) and I would assume that mod_substitute does the same. The backslash (\) escape is used in every regex version I've encountered. Note that ...


0

Add AllowOverride All in the directory settings within the vhost and that should solve your issues.


0

The modules which come preloaded in Apache through cPanel are loaded to provide what cPanel believes is the most secure and stable web server for a host to use. Many of them are required for stable functionality of apache or cPanel themselves though cPanel obviously does not identify specifically which ones it depends on when it installs them anyway. To see ...


4

how this workaround indeed works PHP runs later in the request, so most of the time you can simply override any headers that Apache has already set in your PHP code. That's pretty much it. (Aside: Sending 403s through your 404 handler in this way obviously makes it harder to trigger a real 403 from your Apache config/.htaccess, if you should need to.) ...



Top 50 recent answers are included