Implement SEO improvements and enforce HTTPS redirection in production
- Added a middleware to enforce HTTPS and canonical host for known public hosts, enhancing security and SEO. - Introduced a function to generate the sitemap.xml dynamically, improving the delivery of SEO data to crawlers. - Updated the sitemap route to utilize the new function, ensuring stable delivery and error handling. These changes collectively enhance the application's SEO capabilities and ensure secure access in production environments.
This commit is contained in:
69
SEO-TODO.md
Normal file
69
SEO-TODO.md
Normal file
@@ -0,0 +1,69 @@
|
||||
# SEO TODO (offene Punkte)
|
||||
|
||||
## 1) Host-/TLS-Konsistenz (Apex und www)
|
||||
|
||||
- [x] App-Fallback-Redirect in Node aktiv (`ypchat.net` + HTTP -> `https://www.ypchat.net`).
|
||||
|
||||
### Zertifikatserstellung (Let's Encrypt / Certbot, Apache)
|
||||
|
||||
1. DNS pruefen
|
||||
- `A/AAAA` fuer `ypchat.net` und `www.ypchat.net` muessen auf denselben Server zeigen.
|
||||
2. Certbot installieren (falls noch nicht vorhanden)
|
||||
- Ubuntu: `sudo apt update && sudo apt install certbot python3-certbot-apache`
|
||||
3. Zertifikat fuer beide Hosts ausstellen
|
||||
- `sudo certbot --apache -d ypchat.net -d www.ypchat.net`
|
||||
4. Auto-Renew testen
|
||||
- `sudo certbot renew --dry-run`
|
||||
5. Apache neu laden
|
||||
- `sudo systemctl reload apache2`
|
||||
|
||||
### Apache-Redirects (kanonischer Host + HTTPS)
|
||||
|
||||
Empfohlene Logik:
|
||||
- `http://ypchat.net/*` -> `https://www.ypchat.net/*` (301)
|
||||
- `http://www.ypchat.net/*` -> `https://www.ypchat.net/*` (301)
|
||||
- `https://ypchat.net/*` -> `https://www.ypchat.net/*` (301)
|
||||
- Nur `https://www.ypchat.net/*` liefert `200`
|
||||
|
||||
Beispiel (VirtualHost fuer Port 80):
|
||||
|
||||
```apache
|
||||
<VirtualHost *:80>
|
||||
ServerName ypchat.net
|
||||
ServerAlias www.ypchat.net
|
||||
RewriteEngine On
|
||||
RewriteRule ^ https://www.ypchat.net%{REQUEST_URI} [R=301,L]
|
||||
</VirtualHost>
|
||||
```
|
||||
|
||||
Beispiel (VirtualHost fuer `https://ypchat.net`):
|
||||
|
||||
```apache
|
||||
<VirtualHost *:443>
|
||||
ServerName ypchat.net
|
||||
SSLEngine on
|
||||
SSLCertificateFile /etc/letsencrypt/live/ypchat.net/fullchain.pem
|
||||
SSLCertificateKeyFile /etc/letsencrypt/live/ypchat.net/privkey.pem
|
||||
RewriteEngine On
|
||||
RewriteRule ^ https://www.ypchat.net%{REQUEST_URI} [R=301,L]
|
||||
</VirtualHost>
|
||||
```
|
||||
|
||||
Verifikation:
|
||||
- `curl -I https://ypchat.net/` -> `301 Location: https://www.ypchat.net/`
|
||||
- `curl -I https://www.ypchat.net/` -> `200`
|
||||
- Browser ohne TLS-Warnung fuer beide Hosts
|
||||
|
||||
## 3) Search Console / Reindexing
|
||||
|
||||
- [ ] In Google Search Console `https://www.ypchat.net` als Hauptproperty nutzen.
|
||||
- [ ] Sitemap neu einreichen: `https://www.ypchat.net/sitemap.xml`.
|
||||
- [ ] Live-Tests ausfuehren fuer:
|
||||
- [ ] `/`
|
||||
- [ ] `/partners`
|
||||
- [ ] `/feedback`
|
||||
- [ ] Fuer diese URLs "Indexierung beantragen".
|
||||
- [ ] Nach 7-14 Tagen kontrollieren:
|
||||
- [ ] "Gecrawlt - zurzeit nicht indexiert"
|
||||
- [ ] "Gefunden - zurzeit nicht indexiert"
|
||||
- [ ] Impressionen/Klicks im Leistungsbericht.
|
||||
Reference in New Issue
Block a user