Redirecting through .htaccess

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • knkk
    New Member
    • Jun 2007
    • 49

    #1

    Redirecting through .htaccess

    I want to redirect a url http://abc.xyz.com/123 to http://www.xyz.com. So the file that will be accessed will be index.php of xyz.com. That index.php should have available to it both abc and 123 (so 123 will be $_SERVER['PHP_SELF'], and abc will come out of $_SERVER['HTTP_HOST']) to enable appropriate processing.

    http://abc.xyz.com already goes to http://www.xyz.com (though configuration by my service provider), and abc can be extracted out of $_SERVER['HTTP_HOST']. However, http://abc.xyz.com/123 seems to be looking for a folder called 123 in the root directory of xyz.com, and is showing up a 404 error when it cannot find any.

    Can someone kindly give me the line(s) to be put in .htaccess to enable http://abc.xyz.com/123 to call index.php of http://www.xyz.com (with 123 being available though $_SERVER['PHP_SELF']? I cannot seem to get it to work.

    Thank you very much for your time!
  • numberwhun
    Recognized Expert Moderator Specialist
    • May 2007
    • 3467

    #2
    I am by no means an expert on this topic, but does this link give you the information you want?

    By searching Google, you can find a lot of articles on this topic. If the above doesn't work for you, check them out.

    Regards,

    Jeff

    Comment

    • knkk
      New Member
      • Jun 2007
      • 49

      #3
      Thanks, Jeff. I found the solution for my subdomain subdirectory redirection problem above, here it is:

      Options +FollowSymLinks
      RewriteEngine on
      RewriteCond %{REQUEST_FILEN AME} !-f
      RewriteCond %{REQUEST_FILEN AME} !-d
      RewriteCond %{REQUEST_URL} !=/favicon.ico
      RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

      Comment

      Working...