Questions #Tagged [apache]

Questions: 4

How can we force the domain to serve securely using HTTPS with an .htaccess file?

Once SSL certificate has been added to the domain, all visitors to the site can be forced to use HTTPS to ensure the website traffic is secure. Below code can be used in .htaccess file:<br> <pre><xmp>RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]</xmp></pre>


#.htaccess     #apache    

What is Kbox Common for Kotlin?

Kbox Common is utility library for Kotlin for the common platform. It is very small but useful utility library for Kotlin (JVM, Android and JS). It is licensed under Apache 2.0. Below snippet will help you to use this utility library.<br> <pre><xmp>repositories { jcenter() } dependencies { implementation 'ch.tutteli.kbox:kbox:0.15.1-SNAPSHOT' }</xmp></pre>


#apache     #javascript     #kotlin     #jvm     #android    

Getting error in Tomcat 'Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986' while processing the special character in request?

This issue is occurring in most of the tomcat versions from 7.0.88 onwards as tomcat has increased their security and no longer allows special characters in the query string. To fix this issue add relaxedQueryChars attribute under tag under server.xml (%TOMCAT_HOME%/conf) and add special characters which are needed in application in relaxedQueryChars attribute separated by comma. Below is the sample code snippet:<br> <pre><xmp><Connector port="80" protocol="HTTP/1.1" maxThreads="150" connectionTimeout="20000" redirectPort="443" compression="on" compressionMinSize="2048" noCompressionUserAgents="gozilla, traviata" compressableMimeType="text/html,text/xml" relaxedQueryChars="[,]" /></xmp></pre>


#apache     #error     #apache-tomcat    

What is .htaccess file? And in .htaccess how to rewrite url folder/file.php to folder/file?

An .htaccess file is a directory-level configuration file supported by several web servers. It is used for configuration of website-access issues, such as URL redirection, URL shortening, access control, customized error responses, cache control and more. <br> When a .htaccess file is placed in a directory which is in turn 'loaded via the Apache Web Server', then the .htaccess file is detected and executed by the Apache Web Server software. <br> Following code need to be written in .htaccess file to rewrite url folder/file.php to folder/file: <br><br> <pre> RewriteEngine On<br> RewriteRule ^folder/([^/]*)$ folder/file.php [L] </pre> <br><br> <p>Below is another variation where we can pass parameter in the url:</p><br><br> <pre>RewriteRule ^folder/file/([^/]*)$ folder/file.php?name=$1 [L]</pre><br><br> <p>The output of the above url will be something like this if the parameter we are passing in name as file-1:<br> websitename/folder/file/file-1</p>


#php     #.htaccess     #apache