Frage

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?

War es hilfreich?

Lösung

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]
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top