htaccess redirect showing variables

Discussion in 'Apache' started by aleco, Nov 10, 2005.

  1. #1
    I've just decided to switch my site on a subdomain to it's own proper domain. I therefore used the following in the .htaccess file to direct it all:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^subdomain\.othersite\.com [nc]
    RewriteRule (.*) http://www.newsite.com/$1 [R=301,L]

    That works nicely enough, except it adds my variables I rewrote with htaccess elsewhere onto the end of the url :( Any ideas on how to stop this? :confused:

    examples:

    http://mms.mob453.com/view/1204.html becomes:
    http://www.mobmms.com/view.php/1204.html?id=1204

    Thanks for any info :)
     
    aleco, Nov 10, 2005 IP
  2. johnt

    johnt Peon

    Messages:
    178
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Are the lines
    RewriteCond %{HTTP_HOST} ^subdomain\.othersite\.com [nc]
    RewriteRule (.*) http://www.newsite.com/$1 [R=301,L]
    Code (markup):
    before all the other rewrite stuff ?
     
    johnt, Nov 10, 2005 IP
  3. aleco

    aleco Active Member

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #3
    Afterwards, I just added it to the end. Should I have stuck it at the top? I'll give that a try now...


    edit: woohoo! Thanks for the suggestion - works fine now! I'll just go slap my hand again my forehead for a while now :eek:
     
    aleco, Nov 10, 2005 IP
  4. raonaveed

    raonaveed Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hi!
    sounds like what i was looking can you please write full code thanks.
     
    raonaveed, Dec 31, 2007 IP