Domanda

I need redirect "year-slug" post/pages to same name subdomain, like this:

http://domain.com/2013/post-name/ to http://2013.domain.com/2013/post-name/

this is possible?

È stato utile?

Soluzione

Put this code in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www\.)?(domain\.com)$ [NC]
RewriteRule ^([0-9]{4})/.+$ http://$1.%1%{REQUEST_URI} [R=301,L,NE]
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top