Taula de continguts

.htaccess rewrites (redirecciones)

/via:http://deteresa.com/redireccion-301/ hay que tener el mod_rewrite activo

Options +FollowSymlinks
RewriteEngine on
RedirectMatch permanent ^/(.*) http://<url>/$1

zxc.cat

RewriteEngine on
RewriteRule ^wiki.*$ https://miguelangel.torresegea.es/wiki/$1 [r=307,L]
RewriteRule ^blog.*$ https://miguelangel.torresegea.es/blog/$1 [r=307,L]
RewriteRule ^sqleditor.*$ https://miguelangel.torresegea.es/bike-9b12022-portable/ [r=307,L]
RewriteRule ^sql.*$ https://miguelangel.torresegea.es/sqldesigner/ [r=307,L]
RewriteRule ^estellar.*$ https://bitbucket.org/estellarcat/workspace/projects/EST [r=307,L]
RewriteRule ^diezminutos.*$ https://bitbucket.org/10minutos/workspace/projects/XMIN [r=307,L]
RewriteRule ^text.*$ https://www.outpan.com/app/e7d5b37405/mytextarea [r=307,L]
RewriteRule ^k1.*$ https://k1.vividumcodex.com/ [r=307,L]
RewriteRule ^montmany.*$ https://fruitsmontmany.cat/wp-admin [r=307,L]
 
RewriteCond %{HTTP_HOST} zxc.cat$ [NC]
RewriteCond %{REQUEST_URI} !^/help
RewriteCond %{REQUEST_URI} !^/bofh-excuse
RewriteRule ^(.*)$ https://miguelangel.torresegea.es/wiki/$1 [r=307,L]

301

www

Más información: http://deteresa.com/redireccion-301

http a https

otros

/vía: http://www.besthostratings.com/articles/force-ssl-htaccess.html

en este caso, las peticiones a www.entregaelbalon.com irán automáticamente a www.entregaelbalon.com/copadelrey (si se intenta con redirect da bucle)

redireccions

.htaccess
RewriteEngine on
rewriterule ^(.*)coneixelteucervell(.*)$ https://fidmag.org/ca/subwebs/participa-i-descobreix-el-teu-cervell.html [r=301,nc]
rewriterule ^(.*)$ https://fidmag.org/es/subwebs-esp/participa-y-descubre-tu-cerebro.html [r=301,nc]
<VirtualHost *:80>
    ServerName landing.fidmag.org
    Redirect permanent / https://landing.fidmag.org/
</VirtualHost>

<VirtualHost *:80>
    ServerName brainpredict.com
    ServerAlias www.brainpredict.com 
    Redirect permanent / https://brainpredict.com/
</VirtualHost>

<VirtualHost *:443>
    ServerAdmin webmaster@localhost
    ServerName landing.fidmag.org
    ServerAlias braindredict.com

    DocumentRoot /var/landing.fidmag.org/public
    <Directory /var/landing.fidmag.org/public>
        #Options -Indexes
        Options FollowSymLinks Indexes
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog /var/landing.fidmag.org/log/error.log
    CustomLog /var/landing.fidmag.org/log/access.log combined

    SSLEngine on
    SSLCertificateFile  /etc/letsencrypt/live/landing.fidmag.org/ssl.pem

    <FilesMatch "\.(cgi|shtml|phtml|php)$">
            SSLOptions +StdEnvVars
    </FilesMatch>
    <Directory /usr/lib/cgi-bin>
            SSLOptions +StdEnvVars
    </Directory>
</VirtualHost>

bloquear referrer maliciosos (no hotlinking)