如何将xampp localhost更改为另一个文件夹(xampp文件夹外)?

我怎样才能将我的默认xampp本地主机c:xampp/htdoc更改为另一个文件夹,即c:/alan ? 当我使用IP地址时,我应该能够在C:/alan查看我的网站文件。

谢谢你帮助我

编辑httpd.conf文件并将DocumentRoot“/ home / user / www”行replace为您喜欢的文件。

对于Windows,默认的DocumentRootpath是不同的[以上是针对linux的]。

请遵循@ Sourav的build议。

如果重新启动服务器后出现错误,则可能还需要设置目录选项。 这是在httpd.conf中的<Directory>标记中完成的。 确保最终的configuration如下所示:

 DocumentRoot "C:\alan" <Directory "C:\alan"> Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> 

脚步 :

  1. 运行你的xampp控制面板
  2. 点击configurationbutton
  3. selectapache(httpd.conf)
  4. find文档根目录

更换

 DocumentRoot "C:/xampp/htdocs" <Directory "C:/xampp/htdocs"> 

那两条线

| C:/ xampp / htdocs ==根目录的当前位置

|用任何您想要的位置更改C:/ xampp / htdocs |

  1. 保存

完成:启动Apache并转到本地主机中查看操作[ 观看video点击这里 ]

对于Xampp 1.8.3-5 ,Ubuntu 14.04可以Xampp 1.8.3-5

第1步: –/opt/lampp/etc/httpd.conf更改DocumentRootDirectorypath

DocumentRoot "/opt/lampp/htdocs"Directory "/opt/lampp/htdocs"

DocumentRoot "/home/user/Desktop/js"Directory "/home/user/Desktop/js"

步骤2 : – 将文件夹的权限(在path及其父文件夹中更改为777)例如通过

sudo chmod -R 777 /home/user/Desktop/js

为了防止有人在寻找这个,Linux上Sourav的文件path(httpd.conf)的path是/opt/lampp/etc/httpd.conf

对我来说,这是在第183行,但它只适用于你重新启动你的电脑后。 我希望有一种方法可以快速更改,而不必每次重新启动,但现在这是我知道如何做的唯一方法。

@Hooman:实际上,使用最新版本的Xampp,您不需要知道configuration或日志文件的位置; 在控制面板中,您可以使用每个工具(php,mysql,tomcat …)的日志和configurationbutton,然后单击它们以打开所有相关文件(甚至可以使用顶部的常规configurationbutton来更改默认的编辑应用程序对)。 对于devise它的人来说,做得好!

我不得不改变httpd.conf和httpd-ssl.conf文件的DocumentRoot属性,以获得像相对链接(即href =“/ index.html”)和favicon.ico链接正常工作。

最新的Xampp控制面板使这非常容易。

从控制面板,第一行应该有Apache。 如果它开始,停止它。 然后点击config并打开httpd.conf文件并searchhtdocs或documentRoot。 改变你喜欢的path。 对httpd-ssl.conf执行相同的操作。 这些应该是Config下拉列表中的前两个文件。

然后再次启动服务器。

希望这有助于某人。 干杯。

在Linux Mint(基于Debian)上转到/opt/lampp/etc/httpd.conf

findYOUR_OWN_FILES_LOCATION,当然,您的文件的位置。

 DocumentRoot "YOUR_OWN_FILES_LOCATION" <Directory "YOUR_OWN_FILES_LOCATION"> # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/trunk/mod/core.html#options # for more information. # #Options Indexes FollowSymLinks # XAMPP Options Indexes FollowSymLinks ExecCGI Includes # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # #AllowOverride None # since XAMPP 1.4: AllowOverride All # # Controls who can get stuff from this server. # Require all granted </Directory> 
Interesting Posts