Category: Uncategorized

  • A .htaccess file for Apache httpd for Angular and Laravel

    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
    
    # Ensure the default index file is the Angular app's index.html
    # DirectoryIndex fe/dist/frontend/browser/index.html
    
    <IfModule mod_rewrite.c>
        RewriteEngine On
    
        # Ensure the root URL (/) serves index.html
        RewriteCond %{HTTP_HOST} ^demo\.domain\.com$ [NC]
        RewriteCond %{REQUEST_URI} ^/$
        RewriteRule ^$ /fe/dist/frontend/browser/index.html [L]
    
        # Frontend SPA Routing (demo.domain.com) - Serve index.html for non-static files
        #RewriteCond %{HTTP_HOST} ^demo\.domain\.com$ [NC]
        # Exclude Angular static assets from being rewritten
        #RewriteCond %{REQUEST_URI} ^/.*\.(?:js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|json|txt|map)$ [NC]
        #RewriteRule .* - [L]
    
        # Exclude Angular static assets from being rewritten
        RewriteCond %{REQUEST_URI} \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|json|txt|map)$ [NC]
        RewriteRule ^fe/dist/frontend/browser/(.*)$ fe/dist/frontend/browser/$1 [L]
    
        # Ensure static files are served correctly
        RewriteCond %{REQUEST_URI} \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|json|txt|map)$ [NC]
        RewriteCond %{DOCUMENT_ROOT}/fe/dist/frontend/browser/$1 -f
        RewriteRule ^(.*)$ /fe/dist/frontend/browser/$1 [L]
    
        # Frontend SPA Routing (demo.domain.com) - Serve index.html for non-static files
        RewriteCond %{HTTP_HOST} ^demo\.domain\.com$ [NC]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ /fe/dist/frontend/browser/index.html [L]
    
        # Laravel API Routing (demo-api.domain.com)
        RewriteCond %{HTTP_HOST} ^demo-api\.domain\.com$ [NC]
        RewriteRule ^api/(.*)$ pipeline_be/public/index.php/$1 [L]
    </IfModule>

    Here the demo and demo-api are two sub domains of the domain.

  • SCP – Secure Copy

    scp source destination

    scp -i .ssh/key ./test.txt ubuntu@ip:~/

    This will copy the file test.txt from the source machine where this scp command is being run to the destination machine at ip address. They key will be used from .ssh folder with the name of key file as key.