empty load issue fixed

This commit is contained in:
akash 2025-12-06 21:59:32 +05:30
parent 1d22961058
commit bd1fa7fba4
4 changed files with 100 additions and 30 deletions

View File

@ -4,7 +4,7 @@
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev",
"build": "next build", "build": "next build && node scripts/copy-htaccess.cjs",
"start": "next start", "start": "next start",
"lint": "eslint", "lint": "eslint",
"sitemap": "node scripts/generate-sitemap.cjs" "sitemap": "node scripts/generate-sitemap.cjs"

View File

@ -1,36 +1,61 @@
# Antalya Restaurant - Apache Configuration
# Handles trailing slashes and prevents 403 errors
<IfModule mod_rewrite.c> <IfModule mod_rewrite.c>
RewriteEngine On RewriteEngine On
RewriteBase / RewriteBase /
# Allow Next.js static files and assets # Force HTTPS (optional, uncomment if needed)
RewriteRule ^_next/ - [L] # RewriteCond %{HTTPS} off
RewriteRule ^static/ - [L] # RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
# Serve existing files or directories directly # Handle trailing slashes
RewriteCond %{REQUEST_FILENAME} -f [OR] # If a directory exists with the name, serve its index.html
RewriteCond %{REQUEST_FILENAME} -d RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ - [L] RewriteCond %{REQUEST_URI} !(.*)/$
RewriteCond %{REQUEST_FILENAME}/index.html -f
RewriteRule ^(.*)$ $1/ [R=301,L]
# Redirect extensionless URLs to trailing slash directories # Serve index.html for directories
# Works with "trailingSlash: true" and static export RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ $1/index.html [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}/index.html -f
RewriteRule ^(.+)$ /$1/ [R=301,L]
# Apache 404 (Next.js static export supports 404.html) # Specific rewrites for main pages (with and without trailing slash)
ErrorDocument 404 /404.html RewriteRule ^about-antalya-restaurant/?$ about-antalya-restaurant/index.html [L]
RewriteRule ^antalya-restaurant-menu/?$ antalya-restaurant-menu/index.html [L]
RewriteRule ^antalya-restaurant-gallery/?$ antalya-restaurant-gallery/index.html [L]
RewriteRule ^book-a-table/?$ book-a-table/index.html [L]
RewriteRule ^catering-services-ontario/?$ catering-services-ontario/index.html [L]
RewriteRule ^antalya-turkish-food-blog/?$ antalya-turkish-food-blog/index.html [L]
# Blog posts
RewriteRule ^antalya-turkish-food-blog/([^/]+)/?$ antalya-turkish-food-blog/$1/index.html [L]
# Prevent directory listing
Options -Indexes
# Custom error pages
ErrorDocument 404 /404.html
</IfModule> </IfModule>
# Security Headers
<IfModule mod_headers.c> <IfModule mod_headers.c>
# Cache static assets aggressively Header set X-Content-Type-Options "nosniff"
<FilesMatch "\.(js|css|png|jpg|jpeg|gif|ico|svg|webp)$"> Header set X-Frame-Options "DENY"
Header set Cache-Control "public, max-age=31536000, immutable" Header set X-XSS-Protection "1; mode=block"
</FilesMatch> </IfModule>
# HTML is not cached (important for updated content) # Cache Control
<FilesMatch "\.(html)$"> <IfModule mod_expires.c>
Header set Cache-Control "public, max-age=0, must-revalidate" ExpiresActive On
</FilesMatch> ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/webp "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"
ExpiresByType text/css "access plus 1 year"
ExpiresByType text/javascript "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType image/x-icon "access plus 1 year"
</IfModule> </IfModule>

18
scripts/copy-htaccess.cjs Normal file
View File

@ -0,0 +1,18 @@
const fs = require('fs');
const path = require('path');
// Copy .htaccess from public to out directory after build
const source = path.join(__dirname, '..', 'public', '.htaccess');
const destination = path.join(__dirname, '..', 'out', '.htaccess');
try {
if (fs.existsSync(source)) {
fs.copyFileSync(source, destination);
console.log('✓ .htaccess copied to out directory');
} else {
console.warn('⚠ .htaccess not found in public directory');
}
} catch (error) {
console.error('Error copying .htaccess:', error.message);
process.exit(1);
}

View File

@ -1,34 +1,61 @@
{ {
"trailingSlash": true, "trailingSlash": true,
"cleanUrls": false,
"rewrites": [ "rewrites": [
{ {
"source": "/about-antalya-restaurant", "source": "/about-antalya-restaurant",
"destination": "/about-antalya-restaurant/index.html" "destination": "/about-antalya-restaurant/index.html"
}, },
{
"source": "/about-antalya-restaurant/",
"destination": "/about-antalya-restaurant/index.html"
},
{ {
"source": "/antalya-restaurant-menu", "source": "/antalya-restaurant-menu",
"destination": "/antalya-restaurant-menu/index.html" "destination": "/antalya-restaurant-menu/index.html"
}, },
{
"source": "/antalya-restaurant-menu/",
"destination": "/antalya-restaurant-menu/index.html"
},
{ {
"source": "/antalya-restaurant-gallery", "source": "/antalya-restaurant-gallery",
"destination": "/antalya-restaurant-gallery/index.html" "destination": "/antalya-restaurant-gallery/index.html"
}, },
{
"source": "/antalya-restaurant-gallery/",
"destination": "/antalya-restaurant-gallery/index.html"
},
{ {
"source": "/book-a-table", "source": "/book-a-table",
"destination": "/book-a-table/index.html" "destination": "/book-a-table/index.html"
}, },
{
"source": "/book-a-table/",
"destination": "/book-a-table/index.html"
},
{ {
"source": "/catering-services-ontario", "source": "/catering-services-ontario",
"destination": "/catering-services-ontario/index.html" "destination": "/catering-services-ontario/index.html"
}, },
{
"source": "/catering-services-ontario/",
"destination": "/catering-services-ontario/index.html"
},
{ {
"source": "/antalya-turkish-food-blog", "source": "/antalya-turkish-food-blog",
"destination": "/antalya-turkish-food-blog/index.html" "destination": "/antalya-turkish-food-blog/index.html"
}, },
{
"source": "/antalya-turkish-food-blog/",
"destination": "/antalya-turkish-food-blog/index.html"
},
{ {
"source": "/antalya-turkish-food-blog/:slug", "source": "/antalya-turkish-food-blog/:slug",
"destination": "/antalya-turkish-food-blog/:slug/index.html" "destination": "/antalya-turkish-food-blog/:slug/index.html"
},
{
"source": "/antalya-turkish-food-blog/:slug/",
"destination": "/antalya-turkish-food-blog/:slug/index.html"
} }
], ],
"headers": [ "headers": [