Diferències
Ací es mostren les diferències entre la revisió seleccionada i la versió actual de la pàgina.
| Ambdós costats versió prèvia Revisió prèvia Següent revisió | Revisió prèvia | ||
| web:apache:htaccess:redirects [20/06/2020 04:02] – [bloquear referrer maliciosos (no hotlinking)] admin | web:apache:htaccess:redirects [05/02/2022 03:29] (actual) – [zxc.cat] mate | ||
|---|---|---|---|
| Línia 21: | Línia 21: | ||
| RewriteRule ^diezminutos.*$ https:// | RewriteRule ^diezminutos.*$ https:// | ||
| RewriteRule ^text.*$ https:// | RewriteRule ^text.*$ https:// | ||
| + | RewriteRule ^k1.*$ https:// | ||
| + | RewriteRule ^montmany.*$ https:// | ||
| RewriteCond %{HTTP_HOST} zxc.cat$ [NC] | RewriteCond %{HTTP_HOST} zxc.cat$ [NC] | ||
| RewriteCond %{REQUEST_URI} !^/help | RewriteCond %{REQUEST_URI} !^/help | ||
| + | RewriteCond %{REQUEST_URI} !^/ | ||
| RewriteRule ^(.*)$ https:// | RewriteRule ^(.*)$ https:// | ||
| </ | </ | ||
| == 301 | == 301 | ||
| - | redireccionar de una página a otra u otro dominio: | + | * redireccionar de una página a otra u otro dominio:< | 
| - | <code apache> | + | |
| Redirect 301 / | Redirect 301 / | ||
| </ | </ | ||
| - | + | * redireccionar solo la página principal del dominio:< | |
| - | redireccionar solo la página principal del dominio: | + | |
| - | <code apache> | + | |
| RedirectMatch 301 ^/$ http:// | RedirectMatch 301 ^/$ http:// | ||
| </ | </ | ||
| - | + | * redireccionar un directorio:< | |
| - | redireccionar un directorio: | + | |
| - | <code apache> | + | |
| Redirect 301 / | Redirect 301 / | ||
| </ | </ | ||
| - | + | * redirección de un subdirectorio + sus páginas:< | |
| - | redirección de un subdirectorio + sus páginas: | + | |
| - | <code apache> | + | |
| RedirectMatch 301 ^/ | RedirectMatch 301 ^/ | ||
| </ | </ | ||
| - | + | * redireccionar dominio< | |
| - | redireccionar dominio | + | |
| - | <code apache> | + | |
| Redirect 301 / http:// | Redirect 301 / http:// | ||
| - | </ | + | </ | 
| - | <code apache> | + | |
| RedirectMatch 301 ^(.*)$ http:// | RedirectMatch 301 ^(.*)$ http:// | ||
| </ | </ | ||
| - | + | * Redireccionar 301 (de técnicos de Colt): <code apache> | |
| - | Redireccionar 301 (de técnicos de Colt) | + | |
| - | <code apache> | + | |
| RewriteEngine on | RewriteEngine on | ||
| rewriterule ^(.*)$ http:// | rewriterule ^(.*)$ http:// | ||
| </ | </ | ||
| - | redireccionar de www a no-www: | + | == www | 
| - | <code apache> | + | * redireccionar de www a no-www:< | 
| < | < | ||
|  |  | ||
| Línia 69: | Línia 60: | ||
| </ | </ | ||
| </ | </ | ||
| - | + | * redireccionar de no-www a www:<code apache> | |
| - | redireccionar de no-www a www | + | |
| - | <code apache> | + | |
| < | < | ||
| RewriteCond %{HTTP_HOST} ^www.example.com [NC] | RewriteCond %{HTTP_HOST} ^www.example.com [NC] | ||
| Línia 78: | Línia 67: | ||
| </ | </ | ||
| Más información: | Más información: | ||
| - | + | * eliminar las www:< | |
| - | eliminar las www: | + | |
| - | <code apache> | + | |
| Options +FollowSymlinks | Options +FollowSymlinks | ||
| RewriteEngine on | RewriteEngine on | ||
| RewriteCond %{http_host} ^www\.example\.com[nc] | RewriteCond %{http_host} ^www\.example\.com[nc] | ||
| RewriteRule ^(.*)$ http:// | RewriteRule ^(.*)$ http:// | ||
| - | </ | + | </ | 
| - | + | ||
| - | <code apache> | + | |
| RewriteEngine On | RewriteEngine On | ||
| RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] | RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] | ||
| RewriteRule ^(.*)$ http:// | RewriteRule ^(.*)$ http:// | ||
| </ | </ | ||
| - | + | * de www. a < | |
| - | cancelar sitio completo "por obras": | + | |
| - | <code apache> | + | |
| RewriteEngine On | RewriteEngine On | ||
| - | RewriteBase / | + | RewriteCond% {} HTTP_HOST! ^ su-site.com $ [NC] | 
| - | RewriteCond %{HTTP_COOKIE} !^.*secret-cookie.*$ [NC] | + | RewriteRule | 
| - | RewriteRule .* maintenance-page.html [NC,L] | + | |
| </ | </ | ||
| - | /vía: [[http:// | + | == http a https | 
| - | utilizar la redirección 301 para evitar penalización en Google: | + |  | 
| - | <code apache> | + | |
| - | Options +FollowSymlinks | + | |
| - | RewriteEngine on | + | |
| - | rewriterule ^(.*)$ http:// | + | |
| - | </ | + | |
| - | + | ||
| - | <code php> | + | |
| - | <?php | + | |
| - | $web_url | + | |
| - | header(" | + | |
| - | header(" | + | |
| - | exit(0); | + | |
| - | ?> | + | |
| - | </ | + | |
| - | + | ||
| - | redirección | + | |
| - | activar el módulo //rewrite// en apache | + | |
| - | < | + | |
| $ sudo a2enmod rewrite | $ sudo a2enmod rewrite | ||
| - | </ | + | </ | 
| - | < | + | |
| # Copia el contenido siguiente en tu archivo .htaccess y colócalo en la raíz de tu sitio web. | # Copia el contenido siguiente en tu archivo .htaccess y colócalo en la raíz de tu sitio web. | ||
| RewriteEngine On | RewriteEngine On | ||
| Línia 137: | Línia 100: | ||
| </ | </ | ||
| - | de www. a < | + | == otros | 
| - | <code apache> | + | * cancelar sitio completo "por obras": | 
| RewriteEngine On | RewriteEngine On | ||
| - | RewriteCond% {} HTTP_HOST! ^ su-site.com $ [NC] | + | RewriteBase / | 
| - | RewriteRule | + | RewriteCond %{HTTP_COOKIE} !^.*secret-cookie.*$ [NC] | 
| + | RewriteRule .* maintenance-page.html [NC,L] | ||
| </ | </ | ||
| - | + | /vía: [[http:// | |
| - | redireccionar una petición de la raiz de la página web a una carpeta: | + | * utilizar la redirección 301 para evitar penalización en Google:< | 
| - | <code apache> | + | Options +FollowSymlinks | 
| + | RewriteEngine on | ||
| + | rewriterule ^(.*)$ http:// | ||
| + | </ | ||
| + | * en PHP:< | ||
| + | <?php | ||
| + | $web_url =" | ||
| + | header(" | ||
| + | header(" | ||
| + | exit(0); | ||
| + | ?> | ||
| + | </ | ||
| + |  | ||
| RewriteEngine On | RewriteEngine On | ||
| RewriteCond %{HTTP_HOST} ^entregaelbalon\.com$ [OR] | RewriteCond %{HTTP_HOST} ^entregaelbalon\.com$ [OR] | ||