1

I have a DNS where I have 3 entries as below

    www A 1.1.1.1
    blog A 1.1.1.1
    post A 1.1.1.1

Now My main website is www.something.com which is working fine

now i want blog.something.com should redirect to www.something.com/?page_id=2461

&

post.soemthing.com should redirect to www.something.com/?page_id=2409

DNS and Webserver is on same physical machine.

I am little new to .htaccess codes.

BudwiseЯ
  • 1,846
  • 2
  • 16
  • 28
Ashish
  • 1,856
  • 18
  • 30

1 Answers1

1

Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^blog\.something\.com$ [NC]
RewriteRule ^$ http://www.something.com/?page_id=2461 [R=302,L,QSA]

RewriteCond %{HTTP_HOST} ^post\.something\.com$ [NC]
RewriteRule ^$ http://www.something.com/?page_id=2409 [R=302,L,QSA]

Once you verify it is working fine, replace R=302 to R=301. Avoid using R=301 (Permanent Redirect) while testing your mod_rewrite rules.

anubhava
  • 761,203
  • 64
  • 569
  • 643
  • If this answer helped you solve your problem, please consider marking it as "accepted", so users facing a similar problem in the future will be able to see it easily. – anubhava Jun 18 '13 at 08:37