Wants to Redirect the URL

Discussion in 'Apache' started by Namrata Shah, Oct 25, 2010.

  1. #1
    Hi All,

    I want to rewrite the urls-
    1. xyz.ibizunited.com
    to
    http://xyz.ibizunited.com/CMS/xyz.ibizunited.com/home

    I have successfully done this by:
    RewriteEngine on
    RewriteRule ^(.*)/$ /CMS/%{HTTP_HOST}/home [L,R]

    2. http://xyz.ibizunited.com/CMS/pagelink?pageId=22
    to
    http://xyz.ibizunited.com/CMS/xyz.ibizunited.com/pagelink?pageId=22

    I didn't get success to rewrite this.
    could you guys please give me a way to get this done.

    Thanks in advance.
     
    Namrata Shah, Oct 25, 2010 IP
  2. scriptinstaller

    scriptinstaller Peon

    Messages:
    109
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Here's a quick shot, Please give rep if helpful. Enjoy!


    RewriteRule ^/CMS/pagelink?pageId=([0-9]+)$ /CMS/xyz.ibizunited.com/pageId=$1 [L]
     
    scriptinstaller, Oct 25, 2010 IP
  3. Namrata Shah

    Namrata Shah Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks sinstaller for replying:):)

    but this didn't work.
    even no redirection rule is applied to url

    I have checked ^/CMS/pagelink?pageId=([0-9]+)$ rule by taking parts.

    till pagelink it works fine.
    i mean whatever rewriting is given , is applied to url.

    but when I try to append ?pageId=(...)$ , It stops working and no url rewriting take place.

    and yes one thing, we should have the 1st argument of rule as ^(.*)/CMS/pagelink?pageId=([0-9]+)$ instead of just ^ in starting.

    I am eager to hear any other idea, u have.

    Thanks.
     
    Namrata Shah, Oct 26, 2010 IP
  4. scriptinstaller

    scriptinstaller Peon

    Messages:
    109
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    try and put a [QSA] in the []
     
    scriptinstaller, Oct 26, 2010 IP
  5. scriptinstaller

    scriptinstaller Peon

    Messages:
    109
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    RewriteRule ^(.*?)/CMS/pagelink?pageId=([0-9]+)$ /$1/CMS/xyz.ibizunited.com/pageId=$2 [L, QSA]
     
    scriptinstaller, Oct 26, 2010 IP
  6. scriptinstaller

    scriptinstaller Peon

    Messages:
    109
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    maybe QSA not need, i read that wrong, as i was eating lunch while replying... :D
     
    scriptinstaller, Oct 26, 2010 IP