Redirect www.example.com to example.com

 https://stackoverflow.com/questions/39303725/virtual-host-force-https-and-redirect-www-to-non-www-but-no-other-subdomains

With the proper use of regular expressions, the redirection of www to a non-www domain is quite simple:

Listen for incoming HTTP connections

<VirtualHost *:80>
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /var/www/example.com

    RewriteEngine on

    # Redirect both www.example.com and example.com to https://example.com
    RewriteCond %{HTTP_HOST} ^(www\.)?(.*) [NC]
    RewriteRule ^ https://%2%{REQUEST_URI} [L,R=301]
</VirtualHost>

Listen for incoming HTTPS connections

<VirtualHost *:443>
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /var/www/example.com

    RewriteEngine on

    # Redirect www.example.com to example.com
    RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
    RewriteRule ^ https://%1%{REQUEST_URI} [L,R=301]
</VirtualHost>

These virtual host directives only apply to URLs starting with domain.com and www.domain.com because incoming requests must match the ServerName or ServerAlias. This means that any subdomain such as sub.example.com cannot be a successful match.

Adding a local repository to GitHub using Git

 https://docs.github.com/en/migrations/importing-source-code/using-the-command-line-to-import-source-code/adding-locally-hosted-code-to-github

Before you can add your local repository to GitHub using Git, you must authenticate to GitHub on the command line. For more information, see About authentication to GitHub.

  1. Create a new repository on GitHub. To avoid errors, do not initialize the new repository with README, license, or gitignore files. You can add these files after your project has been pushed to GitHub. For more information, see Creating a new repository.

  2. At the top of your repository on GitHub's Quick Setup page, click  to copy the remote repository URL.

    Screenshot of the "Quick Setup" header in a repository. Next to the remote URL, an icon of two overlapping squares is outlined in orange.

  3. Open Git Bash.

  4. Change the current working directory to your local project.

  5. To add the URL for the remote repository where your local repository will be pushed, run the following command. Replace REMOTE-URL with the repository's full URL on GitHub.

    git remote add origin REMOTE-URL
    

    For more information, see Managing remote repositories.

  6. To verify that you set the remote URL correctly, run the following command.

    git remote -v
    
  7. To push the changes in your local repository to GitHub, run the following command.

    git push origin main
    

    If your default branch is not named "main," replace "main" with the name of your default branch.

how to use forever with npm

 https://stackoverflow.com/questions/62236455/how-to-use-forever-with-npm

try this command:
forever start -c "npm start" ./

running your application's specific directory:

forever start -c "npm start" /path/dir/

or use this command:

forever --sourceDir /path/dir/ -c "npm start" /

Redirect www.example.com to example.com

 https://stackoverflow.com/questions/39303725/virtual-host-force-https-and-redirect-www-to-non-www-but-no-other-subdomains With the proper u...