Skip to main content

Overview

The DNI Cita Previa project is a static website that can be hosted on any platform that supports HTML, CSS, and JavaScript files. This guide covers the most popular and recommended deployment options.

GitHub Pages

GitHub Pages is a free hosting service perfect for static websites.

Prerequisites

  • GitHub account
  • Git installed locally
  • Repository containing your project

Deployment Steps

# Initialize git repository (if not already done)
git init

# Add all files
git add .

# Commit files
git commit -m "Initial commit: DNI Cita Previa redesign"

# Add remote repository
git remote add origin https://github.com/yourusername/dni-cita-previa.git

# Push to GitHub
git push -u origin main
  1. Go to your repository on GitHub
  2. Click Settings tab
  3. Scroll down to Pages section
  4. Under “Source”, select Deploy from a branch
  5. Choose branch: main and folder: / (root)
  6. Click Save
Your site will be available at:
https://yourusername.github.io/dni-cita-previa/
Deployment typically takes 1-2 minutes.

Custom Domain (Optional)

# Add a CNAME file to your repository
echo "www.example.com" > CNAME
git add CNAME
git commit -m "Add custom domain"
git push
Then configure your DNS provider:
TypeNameValue
CNAMEwwwyourusername.github.io
A@185.199.108.153
A@185.199.109.153
A@185.199.110.153
A@185.199.111.153
GitHub Pages supports HTTPS automatically for both *.github.io domains and custom domains.

Netlify

Netlify offers continuous deployment with advanced features like form handling and serverless functions.

Method 1: Drag & Drop

  1. Visit netlify.com
  2. Sign up or log in
  3. Drag your project folder to the Netlify dashboard
  4. Your site is live instantly!

Method 2: Git Integration

  1. Log in to Netlify
  2. Click Add new siteImport an existing project
  3. Choose GitHub (or GitLab/Bitbucket)
  4. Authorize Netlify to access your repositories
  5. Select your DNI Cita Previa repository
Since this is a static site with no build process:
  • Build command: Leave empty
  • Publish directory: ./ (or leave empty)
  • Production branch: main
Click Deploy site
  1. Go to Site settingsDomain management
  2. Click Add custom domain
  3. Enter your domain name
  4. Follow DNS configuration instructions
Netlify automatically provisions SSL certificates.

Netlify Configuration File

Create netlify.toml in your project root for advanced settings:
[[headers]]
  for = "/*"
  [headers.values]
    X-Frame-Options = "DENY"
    X-Content-Type-Options = "nosniff"
    X-XSS-Protection = "1; mode=block"
    Referrer-Policy = "strict-origin-when-cross-origin"

[[redirects]]
  from = "/*"
  to = "/index.html"
  status = 200

# Cache static assets
[[headers]]
  for = "/css/*"
  [headers.values]
    Cache-Control = "public, max-age=31536000, immutable"

[[headers]]
  for = "/js/*"
  [headers.values]
    Cache-Control = "public, max-age=31536000, immutable"

[[headers]]
  for = "/images/*"
  [headers.values]
    Cache-Control = "public, max-age=31536000, immutable"

Vercel

Vercel provides fast global deployment with edge network optimization.

Deploy with Vercel CLI

# Install Vercel CLI
npm i -g vercel

Deploy via Git

  1. Push code to GitHub/GitLab/Bitbucket
  2. Visit vercel.com
  3. Click Add NewProject
  4. Import your repository
  5. Click Deploy

Vercel Configuration

Create vercel.json in your project root:
{
  "version": 2,
  "public": true,
  "headers": [
    {
      "source": "/(.*)",
      "headers": [
        {
          "key": "X-Content-Type-Options",
          "value": "nosniff"
        },
        {
          "key": "X-Frame-Options",
          "value": "DENY"
        },
        {
          "key": "X-XSS-Protection",
          "value": "1; mode=block"
        }
      ]
    },
    {
      "source": "/css/(.*)",
      "headers": [
        {
          "key": "Cache-Control",
          "value": "public, max-age=31536000, immutable"
        }
      ]
    },
    {
      "source": "/js/(.*)",
      "headers": [
        {
          "key": "Cache-Control",
          "value": "public, max-age=31536000, immutable"
        }
      ]
    },
    {
      "source": "/images/(.*)",
      "headers": [
        {
          "key": "Cache-Control",
          "value": "public, max-age=31536000, immutable"
        }
      ]
    }
  ]
}

Traditional Hosting (cPanel, FTP)

For traditional web hosting providers:

Via FTP

Ensure your project structure is ready:
├── index.html
├── iniciar-solicitud.html
├── seleccionar-cita.html
├── resumen.html
├── css/
├── js/
└── images/
Use an FTP client like FileZilla:
  1. Host: ftp.yourdomain.com
  2. Username: Your FTP username
  3. Password: Your FTP password
  4. Port: 21 (or 22 for SFTP)
  1. Navigate to public_html or www directory
  2. Upload all project files
  3. Maintain the same folder structure
  4. Ensure permissions are set correctly (755 for directories, 644 for files)

Via cPanel File Manager

  1. Log in to cPanel
  2. Open File Manager
  3. Navigate to public_html
  4. Click Upload
  5. Upload a ZIP file of your project
  6. Extract the ZIP file
  7. Move files from subfolder to public_html if needed
Always test your site after uploading by visiting your domain. Check for:
  • All pages load correctly
  • Images display properly
  • Links work
  • Forms function as expected

Apache Configuration

If using Apache server, create .htaccess file in root directory:
# Enable mod_rewrite
RewriteEngine On

# Force HTTPS
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Remove .html extension
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^.]+)$ $1.html [NC,L]

# Compression
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html text/css text/javascript application/javascript
</IfModule>

# Browser Caching
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType text/css "access plus 1 year"
  ExpiresByType application/javascript "access plus 1 year"
  ExpiresByType image/png "access plus 1 year"
  ExpiresByType image/jpeg "access plus 1 year"
  ExpiresByType image/webp "access plus 1 year"
  ExpiresByType image/avif "access plus 1 year"
</IfModule>

# Security Headers
<IfModule mod_headers.c>
  Header set X-Content-Type-Options "nosniff"
  Header set X-Frame-Options "DENY"
  Header set X-XSS-Protection "1; mode=block"
  Header set Referrer-Policy "strict-origin-when-cross-origin"
</IfModule>

Performance Optimization

Image Optimization

Before deployment, optimize images:
# Using ImageMagick
for img in images/*.png; do
  convert "$img" -quality 85 "${img%.png}.webp"
done

# Using squoosh-cli
npx @squoosh/cli --webp auto images/*.png

Minification

Minify CSS and JavaScript:
# Using clean-css-cli
npx clean-css-cli -o css/style.min.css css/style.css
Update HTML to reference minified files:
<link rel="stylesheet" href="./css/style.min.css">
<script src="./js/index.min.js"></script>

Monitoring & Analytics

Google Analytics

Add tracking code to all pages (before </head>):
<!-- Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'G-XXXXXXXXXX');
</script>

Uptime Monitoring

Recommended tools:

Comparison Table

FeatureGitHub PagesNetlifyVercelTraditional Hosting
Free TierYesYes (100GB/mo)Yes (100GB/mo)Varies
Custom DomainYesYesYesYes
SSL CertificateAutomaticAutomaticAutomaticManual/Paid
DeploymentGit pushGit/Drag & DropGit/CLIFTP/cPanel
Build Time~1-2 minInstantInstantManual
CDNYesYesYesUsually No
RedirectsLimitedYesYesVia .htaccess
FormsNoYesNoServer-side needed
Best ForSimple projectsFull-featured sitesNext-gen performanceFull control

Troubleshooting

404 Errors After Deployment

Problem: Pages return 404 errors. Solution:
  • Check file paths are lowercase and match exactly
  • Verify .html extensions are included in links
  • Add redirect rules (see platform-specific config above)

Images Not Loading

Problem: Images don’t display after deployment. Solution:
  • Use relative paths: ./images/logo.png instead of /images/logo.png
  • Verify image files were uploaded
  • Check file permissions (644 for files)

CSS Not Applying

Problem: Styles don’t appear on live site. Solution:
  • Clear browser cache
  • Check CSS file paths in HTML
  • Verify CSS files were uploaded
  • Check for MIME type issues (should be text/css)

Next Steps

After successful deployment:
  1. Test Thoroughly - Verify all functionality works in production
  2. Set Up Analytics - Monitor traffic and user behavior
  3. Configure Monitoring - Set up uptime alerts
  4. Optimize Performance - Run Lighthouse audits and improve scores
  5. Document Changes - Keep deployment notes for future updates
For government or official deployments, ensure compliance with security policies and accessibility standards (WCAG 2.1 Level AA).

Build docs developers (and LLMs) love