晕,这个不需要重吧,用域名转向不可以吗?
如果你非要重写的话,在.htaccess文件中:
RewriteEngine onRewriteCond %{HTTP_HOST} ^xxx.php.com$
RewriteRule ^(.*)$ /xxx/$1 [L]

解决方案 »

  1.   

    楼上的不行,出现500错误呀
    我找到一个可行的,但有点小问题,就是地址栏也跟着变,比如我访问xxx.abc.com,真实的地址是www.abc.com/xxx,下面的可以转向真实地址,可是地址栏也跟着变成www.abc.com/xxx了,我不想变地址栏,重写不是就不变吗?谁能帮我解决下?
    RewriteEngine on
    RewriteCond   %{HTTP_HOST}                 ^[^{www}]+\.abc\.com$
    RewriteRule   ^(.+)                        %{HTTP_HOST}$1          [C]
    RewriteRule   ^([^{www}]+)\.abc\.com(.*)   http://www.abc.com/$1$2
      

  2.   

    rewriteengine onRewriteCond %{REQUEST_FILENAME}       !-F
    RewriteRule ^([0-9]*)\.html    /test.php/$1 [T]
    后面可以加任意的路径。
      

  3.   

    我那个,你要把.htaccess
    放在
    http://www.php.com/
    对应的目录下面黄肌瘦,不要放在
    xxx里面
      

  4.   

    xxx.php.com和http://www.php.com/指向的位置一样
    也就是说,不放.htaccess的时候,这两个域名访问到的内容一样。
      

  5.   

    TO:goodsong 
    我放在根目录下啊。
    xxx这个就没有呀,是要传这个参数啊。
      

  6.   

    是一样的,我试过了,我这样访问都一样http://任意字符.php.com这访问的都和www.php.com一样,就是htaccess有问题我二楼发的我试过了,可以,但是地址栏给变了。和转向一样了,我不想要这样的效果
      

  7.   

    你看,我用你那个访问xxx.php.com时出现下面错误 Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, [no address given] and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. -------------------------------------------------------------------------------- Apache/1.3.33 Server at 192.168.0.7 Port 80
      

  8.   

    帮你把2楼的改了下,你试试,我这会儿没办法测试RewriteEngine   on
    RewriteCond       %{HTTP_HOST}                                   ^[^{www}]+\.abc\.com$
    RewriteRule       ^(.+)                                                 %{HTTP_HOST}$1                     [C]
    RewriteRule       ^([^{www}]+)\.abc\.com(.*)       /$1$2
      

  9.   

    是啊,这我知道呀,可是应该出现404错误呀,也显示找不到哪个啊,可是现在的错误是500错误Internal Server Error
    The server encountered an internal error or misconfiguration and was unable to complete your request.
    Please contact the server administrator, [no address given] and inform them of the time the error occurred, and anything you might have done that may have caused the error.More information about this error may be available in the server error log.--------------------------------------------------------------------------------Apache/1.3.33 Server at 192.168.0.7 Port 80
      

  10.   

    我晕,麻烦你先搞对的好不好,错误有N种,对的只有一种在根目录下建两个目录
    aaa
    bbb
    放一些可以访问的东西
    这样才可以测试
    aaa.yourdomain.com
    bbb.yourdomain.com
    是不是对的
      

  11.   

    你把你二楼的
    http://www.abc.com/$1$2改成^/$1$2$
    如果象你说的一样,以前转向可以,那现在也应该可以
      

  12.   

    这样我也试了,还是那错误,我访问的xk.php.com在目录下存在xk/index.php
    好像二楼的就正确着了,我再改改,谢谢你,一会结贴,你再帮我看下http://topic.csdn.net/u/20071114/10/32d836ba-5c19-4ada-9d14-9fb0f8542a6d.html
      

  13.   

    我想要本原因是不是重写不能写http:这样的?关键我这根目录不能用,我用的是精简APMXE5,刚才查了半天,说是用DocumentRoot 设根目录?可是我加上后不行呀,正常的都无法显示了
      

  14.   

    不好意思,呵呵,我没搞过asp.net
    php也才开始学,我试了一下,是会出500错误,搞不懂了,你自己多研究:)