# Disable ModSecurity for Livewire uploads (shared hosting fix)
<IfModule mod_security.c>
    SecFilterEngine Off
    SecFilterScanPOST Off
</IfModule>

<IfModule mod_security2.c>
    SecRuleEngine Off
</IfModule>

# ==================================================
# BROWSER CACHE / EFFICIENT CACHE LIFETIMES
# Add this before the mod_rewrite rules
# ==================================================

# Vite production assets use content-hashed filenames,
# so they can be cached safely for one year.
<IfModule mod_setenvif.c>
    SetEnvIf Request_URI "^/(public/)?build/assets/.*\.(css|js)$" vite_hashed_asset=1
</IfModule>

<IfModule mod_headers.c>
    # Vite hashed CSS and JavaScript
    Header set Cache-Control "public, max-age=31536000, immutable" env=vite_hashed_asset

    # Font files
    <FilesMatch "\.(woff2?|ttf|otf|eot)$">
        Header set Cache-Control "public, max-age=31536000, immutable"
    </FilesMatch>

    # Images without hashed filenames
    <FilesMatch "\.(avif|webp|png|jpe?g|gif|svg|ico)$">
        Header set Cache-Control "public, max-age=2592000, stale-while-revalidate=86400"
    </FilesMatch>

    # Video and audio
    <FilesMatch "\.(mp4|webm|ogg|mp3|wav)$">
        Header set Cache-Control "public, max-age=2592000"
    </FilesMatch>
</IfModule>

# Fallback expiry rules for hosts where mod_expires is enabled.
# CSS/JS are intentionally omitted here so unversioned scripts are not
# accidentally cached for one year.
<IfModule mod_expires.c>
    ExpiresActive On

    ExpiresByType font/woff2 "access plus 1 year"
    ExpiresByType font/woff "access plus 1 year"
    ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
    ExpiresByType font/ttf "access plus 1 year"
    ExpiresByType font/otf "access plus 1 year"

    ExpiresByType image/avif "access plus 1 month"
    ExpiresByType image/webp "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/svg+xml "access plus 1 month"
    ExpiresByType image/x-icon "access plus 1 month"

    ExpiresByType video/mp4 "access plus 1 month"
    ExpiresByType video/webm "access plus 1 month"
    ExpiresByType audio/ogg "access plus 1 month"
    ExpiresByType audio/mpeg "access plus 1 month"
</IfModule>

<IfModule mod_rewrite.c>
    RewriteEngine On

    ############################################
    # STEP 1: FORCE HTTPS + WWW
    ############################################
    RewriteCond %{HTTPS} off [OR]
    RewriteCond %{HTTP_HOST} !^www\.eggfirst\.com$ [NC]
    RewriteRule ^(.*)$ https://www.eggfirst.com/$1 [R=301,L]

    ############################################
    # STEP 2: REMOVE /PUBLIC FROM URL
    ############################################
    RewriteCond %{REQUEST_URI} ^/public/(.*)$
    RewriteRule ^public/(.*)$ /$1 [R=301,L]

    ############################################
    # STEP 3: STATIC FILES SERVE KARO
    # (Images, CSS, JS, Fonts, etc.)
    ############################################
    RewriteCond %{DOCUMENT_ROOT}/public/$1 -f
    RewriteRule ^(.*)$ public/$1 [L]

    ############################################
    # STEP 4: LARAVEL HANDLE KARE
    ############################################
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ public/index.php [L]







    ##############################
    # OLD DIGITAL MARKETING URLS
    ##############################
    RewriteCond %{REQUEST_URI} ^/services/digital-marketing/raindrops/?$ [NC]
    RewriteRule ^ https://www.eggfirst.com/services/digital-marketing [R=301,L]

    RewriteCond %{REQUEST_URI} ^/services/media-martech/retail-e-commerce-quick-commerce-media/?$ [NC]
    RewriteRule ^ https://www.eggfirst.com/services/digital-marketing [R=301,L]

    RewriteCond %{REQUEST_URI} ^/services/media-martech/performance-marketing-digital-commerce/?$ [NC]
    RewriteRule ^ https://www.eggfirst.com/services/digital-marketing/performance-marketing-agency [R=301,L]

    RewriteCond %{REQUEST_URI} ^/services/celebrity-influencer-marketing/celebrity-influencer-marketing/?$ [NC]
    RewriteRule ^ https://www.eggfirst.com/services/celebrity-influencer-marketing [R=301,L]
    
    RewriteCond %{REQUEST_URI} ^/services/digital-marketing/performance-marketing-digital-commerce/?$ [NC]
    RewriteRule ^ https://www.eggfirst.com/services/digital-marketing/performance-marketing-agency [R=301,L]

    ##############################
    # BRANDING / VIDEO / DIGITAL PAGES
    ##############################
    RewriteCond %{REQUEST_URI} ^/video-editing-and-animation-services-in-mumbai/?$ [NC]
    RewriteRule ^ https://www.eggfirst.com/services [R=301,L]

    RewriteCond %{REQUEST_URI} ^/branding-and-identity-design-services-in-mumbai/?$ [NC]
    RewriteRule ^ https://www.eggfirst.com/services/brand-building-communication/branding-and-packaging [R=301,L]

    RewriteCond %{REQUEST_URI} ^/digital-media-design-services-in-india/?$ [NC]
    RewriteRule ^ https://www.eggfirst.com/services/digital-marketing/media-planning [R=301,L]

    RewriteCond %{REQUEST_URI} ^/website-development-company-in-mumbai/?$ [NC]
    RewriteRule ^ https://www.eggfirst.com/services/digital-experiential/website-design-development [R=301,L]

    RewriteCond %{REQUEST_URI} ^/email-marketing-services-in-mumbai/?$ [NC]
    RewriteRule ^ https://www.eggfirst.com/services [R=301,L]

    RewriteCond %{REQUEST_URI} ^/content-marketing-services-in-india/?$ [NC]
    RewriteRule ^ https://www.eggfirst.com/services/brand-building-communication/content-creation [R=301,L]

    RewriteCond %{REQUEST_URI} ^/influencer-marketing-agency-in-india/?$ [NC]
    RewriteRule ^ https://www.eggfirst.com/services/celebrity-influencer-marketing [R=301,L]

    RewriteCond %{REQUEST_URI} ^/seo-agency-in-mumbai/?$ [NC,OR]
    RewriteCond %{REQUEST_URI} ^/services/media-martech/seo-agency-mumbai/?$ [NC]
    RewriteRule ^ https://www.eggfirst.com/services/digital-marketing/seo-agency-mumbai [R=301,L]

    RewriteCond %{REQUEST_URI} ^/performance-marketing-agency-in-india/?$ [NC]
    RewriteRule ^ https://www.eggfirst.com/services/digital-marketing/performance-marketing-agency [R=301,L]

    RewriteCond %{REQUEST_URI} ^/social-media-optimization-services-in-india/?$ [NC]
    RewriteRule ^ https://www.eggfirst.com/services/digital-marketing/social-media-marketing-agency [R=301,L]

    ##############################
    # ADVERTISING / STRATEGY / RURAL PAGES
    ##############################
    RewriteCond %{REQUEST_URI} ^/radio-advertising-services-in-mumbai/?$ [NC]
    RewriteRule ^ https://www.eggfirst.com/services [R=301,L]

    RewriteCond %{REQUEST_URI} ^/print-advertising-services-in-mumbai/?$ [NC]
    RewriteRule ^ https://www.eggfirst.com/services [R=301,L]

    RewriteCond %{REQUEST_URI} ^/television-advertising-services-in-mumbai/?$ [NC]
    RewriteRule ^ https://www.eggfirst.com/services/brand-building-communication/ad-film-production [R=301,L]

    RewriteCond %{REQUEST_URI} ^/brand-position-strategy-services/?$ [NC]
    RewriteRule ^ https://www.eggfirst.com/services/strategy-consulting/brand-strategy [R=301,L]

    RewriteCond %{REQUEST_URI} ^/rural-media-outreach-services/?$ [NC]
    RewriteRule ^ https://www.eggfirst.com/services/strategy-consulting/rural-semi-urban-marketing [R=301,L]

    RewriteCond %{REQUEST_URI} ^/rural-brand-activation-services/?$ [NC]
    RewriteRule ^ https://www.eggfirst.com/services/brand-building-communication [R=301,L]



    RewriteCond %{REQUEST_URI} ^/brand-strategy-and-creation-services-in-india/?$ [NC]
    RewriteRule ^ https://www.eggfirst.com/services/strategy-consulting/brand-strategy [R=301,L]

    ##############################
    # PUBLIC FOLDER FALLBACK
    ##############################
    RewriteCond %{REQUEST_URI} !^/public/
    RewriteRule ^(.*)$ public/$1 [L]
    
    ##############################
    # Blogs redirection 
    ##############################
    
    Redirect 301 /blog/emerging-trends-in-marketing-what-to-expect-in-2025.php https://www.eggfirst.com/blogs
    Redirect 301 /blog/eggfirst-unveils-the-future-of-rural-marketing-excellence.php https://www.eggfirst.com/blogs
    Redirect 301 /blog/5-strategies-to-boost-your-e-commerce-business.php https://www.eggfirst.com/blogs
    Redirect 301 /blog/how-performance-marketing-can-drive-results-for-your-business.php https://www.eggfirst.com/blogs
    Redirect 301 /privacy-policy.php https://www.eggfirst.com/about-us
    Redirect 301 /blog/ppc-optimization-5-steps-to-better-ad-performance.php https://www.eggfirst.com/blogs
    Redirect 301 /radio-advertising-services-in-mumbai.php https://www.eggfirst.com/
    Redirect 301 /news/eggfirst-bags-creative-mandate-for-miraj-cinemas.php https://www.eggfirst.com/blogs
    Redirect 301 /news/eggfirst-sweet-16.php https://www.eggfirst.com/blogs
    Redirect 301 /news/eggfirst-womens-day-campaign.php https://www.eggfirst.com/blogs
    Redirect 301 /showreel https://www.eggfirst.com/
    Redirect 301 /chalo-rural-mixer https://www.eggfirst.com/
    Redirect 301 /news/shilpa-medicare-is-runners-up-at-the-cnbc-tv18s-emerging-india-awards.php https://www.eggfirst.com/blogs
    Redirect 301 /blog/how-social-media-marketing-services-can-boost-your-sales.php https://www.eggfirst.com/blogs
    Redirect 301 /clients https://www.eggfirst.com/
    Redirect 301 /news/eggfirst-named-one-of-the-finalists-at-the-united-nations.php https://www.eggfirst.com/blogs
    Redirect 301 /blog/from-seo-to-social-media-digital-marketing-agencies-for-all-your-needs.php https://www.eggfirst.com/blogs
    Redirect 301 /blog/how-small-medium-enterprises-use-social-media.php https://www.eggfirst.com/blogs
    Redirect 301 /news/doodle-ad-fest-2014.php https://www.eggfirst.com/blogs
    Redirect 301 /blog/maximizing-your-roi-with-professional-content-marketing-services.php https://www.eggfirst.com/blogs
    Redirect 301 /news/football-match-with-eggfirst-team.php https://www.eggfirst.com/blogs
    
    ##############################
    # website url 
    ##############################
    
    Redirect 301 /services/influencer-celebrity-management https://www.eggfirst.com/services/celebrity-influencer-marketing
    Redirect 301 /services/media-martech/media-planning https://www.eggfirst.com/services/digital-experiential/marketing-technology-agency
    Redirect 301 /services/mainline-advertising https://www.eggfirst.com/
    Redirect 301 /services/360-storytelling/ad-film-production https://www.eggfirst.com/services/brand-building-communication/ad-film-production
    Redirect 301 /services/influencer-celebrity-management/sponsorship-rights-management https://www.eggfirst.com/services/celebrity-influencer-marketing/sponsorship-rights-management
    Redirect 301 /services/brand-building-communication/social-media-marketing https://www.eggfirst.com/services/digital-marketing/social-media-marketing-agency
    Redirect 301 /services/media-martech/media-planning-buying https://www.eggfirst.com/
    Redirect 301 /services/celebrity-&-influencer-marketing https://www.eggfirst.com/services/celebrity-influencer-marketing
    Redirect 301 /services/360-storytelling/brand-identity-design-and-packaging https://www.eggfirst.com/services/brand-building-communication/branding-and-packaging
    
    # Force redirect exact URL
    RewriteCond %{REQUEST_URI} ^/public/index.php/services/celebrity-influencer-marketing/celebrity-influencer-marketing$ [NC]
    RewriteRule ^(.*)$ /services/celebrity-influencer-marketing [R=301,L]
    
    
    
</IfModule>

# BEGIN cPanel-generated php ini directives, do not edit
<IfModule php7_module>
   php_flag display_errors Off
   php_value max_execution_time 30
   php_value max_input_time 60
   php_value max_input_vars 1000
   php_value memory_limit 256M
   php_value post_max_size 20M
   php_value session.gc_maxlifetime 1440
   php_value session.save_path "/var/cpanel/php/sessions/ea-php74"
   php_value upload_max_filesize 20M
   php_flag zlib.output_compression Off
</IfModule>

<IfModule lsapi_module>
   php_flag display_errors Off
   php_value max_execution_time 30
   php_value max_input_time 60
   php_value max_input_vars 1000
   php_value memory_limit 256M
   php_value post_max_size 20M
   php_value session.gc_maxlifetime 1440
   php_value session.save_path "/var/cpanel/php/sessions/ea-php74"
   php_value upload_max_filesize 20M
   php_flag zlib.output_compression Off
</IfModule>
# END cPanel-generated php ini directives