drupal clean URLs not working? with tilde sign

If your site is developed in Drupal and your URL looks like this:

If your site URL looks like this:

http://[domain name OR IP Address]/~[accountname]/anyFolder/

Example
http://example.com/~xyzaccount/somefolder/
http://xxx.xxx.xxx.xxx/~xyzaccount/somefolder/

Then you need to set RewriteBase!in your .htaccess file that looks like below

RewriteBase /~xyzaccount/somefolder

Force HTTPS url with .htaccess

RewriteCond %{HTTPS} off
# First rewrite to HTTPS:
# Don’t put www. here. If it is already there it will be included, if not
# the subsequent rule will catch it.
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Now, rewrite any request to the wrong domain to use www.
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

How to redirect domain to other directory on the same domain

Open the .htaccess file of your root directory
of your project and add the following line.

RewriteEngine On
RewriteCond %{HTTP_HOST} !^http://someDomainName.com [NC]
RewriteCond %{HTTP_HOST} !^http://www.someDomainName.com [NC]
RewriteCond %{HTTP_HOST}   !^$
RewriteCond %{REQUEST_URI} !^/someOtherDirectory/
RewriteRule ^(.*)$ /someOtherDirectory/$1

Then restart your apache

Usage :
Suppose your project is placed in some other directory
other than the default web directory then you can redirect
your request to that directory for example

Your actual project URL is
"http://someDomaiName/someDirectory/fileName"
and you want that your URL should resemble like
"http://someDomaiName/fileName"
then the above .htaccess rule will do the same.