duanping2695 2011-04-18 07:33
浏览 50

删除路径部分以访问我的网站

I got a rather easy problem. How do I remove the path to my website called domain.com?

I've got a lampp server where I put one folder called "domain" in the htdocs folder and to access my website I need to write domain.com/domain instead of just domain.com. And when I write domain.com I come to the usual xampp website

  • 写回答

2条回答 默认 最新

  • dongrenshi0889 2011-04-18 08:00
    关注

    There are a few options, but the easiest is probably using some URL rewriting given your current setup.

    mod_rewrite in .htaccess

    In your htdocs folder create a .htaccess file:

    RewriteEngine On
    RewriteBase /
    # If the URL does not already exist as a file
    RewriteCond %{REQUEST_FILENAME} !-f
    # or directory
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /domain/$1 [QSA,L,NC]
    

    Virtual hosting with Apache

    You could also edit your VirtualHost container in the Apache configuration to change the directory as well. If you are running XAMPP then I have previously written about using virtual hosts with it on my blog.

    For example:

    <VirtualHost *:80>
        ServerAdmin name@domain.com
        DocumentRoot c:\xampp\simonholywell.com\pub
        ServerName simonholywell.localhost
        <Directory c:\xampp\simonholywell.com\pub>
            Order allow,deny
            Allow from all
        </Directory>
    </VirtualHost>
    

    A development server for teams (or individuals)

    I have also written a large article on setting up a development or staging server for a team as well, which would be good reading if you are setting up such a system. It allows you to simply add a folder on the server and it is immediately available as a subdomain without any further configuration. This is something called mass virtual hosting.

    评论

报告相同问题?

悬赏问题

  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 MATLAB中streamslice问题
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 51单片机中C语言怎么做到下面类似的功能的函数(相关搜索:c语言)
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序