I have this address http://www.example.com and have this page http://www.example.com/world. Can I do this with mod_rewrite,to my page become http://world.example.com ? Any link,tutorial,...,will be nice,if I can do this? And what will be with these links for example:
http://www.example.com/world/some-other-page
http://www.example.com/world/and-second-apge
will these links also be rewritten to :
http://world.example.com/some-other-page
http://world.example.com/and-second-apge
Another question,is this good for SEO ?
I'm sorry on my bad English.
Try this:
RewriteEngine On
RewriteCond %{http_host} ^domain.com [nc]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,NC]
RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
RewriteRule ^world/([a-z0-9\-_\.]+)/?(.*)$ http://$1.domain.com/$2 [QSA,NC,R,L]
so:
http://www.domain.com/world/page => http://world.domain.com/page
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With