I've researched this for about 2 hours now and although most of the topics are similar, none have explained how to do what I'd like to do.
I'm taking a blog that had a structure of blog.domain.com and moving it to www.domain.com/blog/. I need to keep the permalink of the blog post when I redirect so...
blog.domain.com/here-is-a-blog-post/
should become:
www.domain.com/blog/here-is-a-blog-post/
After trying many things, this is the last thing I tried which ends up having no affect at all. Meaning blog.domain.com just sits at blog.domain.com/
RewriteEngine on
RewriteCond %{HTTP_HOST} ^xyz\.domain\.com$
RewriteRule ^/(.*) http://domain.com/$1 [redirect,last]
Here's the entry from my httpd.conf file.
<VirtualHost xxx.xxx.xxx.xxx:80>
SSLEngine off
SuexecUserGroup apache apache
ServerName www.domain.com
ServerAlias domain.com
ServerAlias blog.domain.com
ServerAdmin [email protected]
DocumentRoot /home/domain/www/domain.wiredground.com
ScriptAlias /cgi-bin/ "/home/domain/www/cgi-bin/"
<Directory /home/domain/www/cgi-bin>
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Can anyone help?
Thanks!
use this:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^blog\.domain\.com [NC]
RewriteRule (.*) http://domain.com/blog/$1 [R=301,L]
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