htaccess check url and if nessecary append index.php with a string

Discussion in 'Apache' started by wannabem, Apr 2, 2010.

  1. #1
    Hi,

    I have been searching the internet to get the following done, but i am not finding any solution. there is a lot of material how to change dynamic url to static.

    i have to do the following:

    if it is

    subdomain.mydomain.com
    then change to
    subdomain.mydomain.com/index.php?show=blog

    and if it is
    subdomain.mydomain.com/index.php
    change to
    subdomain.mydomain.com/index.php?show=blog

    if anyone can help me out with the correct htaccess lines, i will be very happy

    rgds,

    W
     
    wannabem, Apr 2, 2010 IP
  2. wannabem

    wannabem Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I have one part working

    www.example.com/index.php - >www.example.com/index.php?show=blog

    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.(htm(l)?|php)\ HTTP/
    RewriteRule ^(([^/]+/)*)index\.(htm(l)?|php)$ http://www.example.com/index.php?show=blog$1 [R=301,L]

    Now the second part is not really working as i need it to be working

    I need it to be a redirect. i have tried :

    RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
    RewriteRule ^*.$ http://www.example.com/index.php?show=blog [R=301,L]

    But this is giving me an error. anyone has any idea?
     
    wannabem, Apr 4, 2010 IP