如何在 WAMP www 目录中使用 Windows 快捷方式?

发布于 2024-12-29 12:23:56 字数 332 浏览 1 评论 0 原文

我想在浏览器中运行 PHP 文件,这些文件存储在与 WAMP 文件夹中的 www 文件夹不同的分区上。我创建了一个快捷方式并将其放在 www 文件夹中,但当我尝试浏览文件 localhost/directory-name/index.html 时出现 404 错误。

如何在 Windows XP 上设置 WAMP www 文件夹中其他文件夹的快捷方式?

好的,经过一些研究,我发现需要在 Apache 配置文件中设置 FollowSymLinks 。它包括Options Indexes FollowSymLinks,但仍然是404错误。

I want to run PHP files in the browser that are stored on a separate partition from the www folder in the WAMP folder. I created a shortcut and put it in the www folder, but got 404 error when I tried to browse the file localhost/directory-name/index.html.

How do you set up shortcuts to other folders in the WAMP www folder on Windows XP?

OK, after doing some research, I found FollowSymLinks needs to be set in the Apache config file. It includes Options Indexes FollowSymLinks, but still 404 error.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

魔法唧唧 2025-01-05 12:23:56

Windows 中的快捷方式具有 .lnk 扩展名,因此 Apache 不知道如何处理 FollowSymLinks(因为它不是正确的符号链接)。

我建议要么只使用别名,例如在 httpd.conf 中放置:

Alias /other_projects "d:/other_projects/"

<Directory "d:/other_projects/">
   Options Indexes FollowSymLinks MultiViews
   Allow from all
</Directory>

或者,您可以使用应用程序在 Windows 下创建正确的符号链接(例如 junction),当您启用 FollowSymLinks 时,可以像 junction c:\wamp\www\other_projects d:\other_projects 一样使用。

Shortcuts in Windows have a .lnk extension so Apache doesn't know what to do with FollowSymLinks (because it's not a proper symlink).

I'd recommend either just using Aliases, e.g. in httpd.conf put:

Alias /other_projects "d:/other_projects/"

<Directory "d:/other_projects/">
   Options Indexes FollowSymLinks MultiViews
   Allow from all
</Directory>

Alternatively you can use an application to create proper sym links under windows (e.g. junction) which can be used like junction c:\wamp\www\other_projects d:\other_projects when you have FollowSymLinks enabled.

圈圈圆圆圈圈 2025-01-05 12:23:56

继 B Seven 的评论之后:只需转到 WAMP 托盘栏图标,单击它并执行以下操作:

Apache -->别名目录 -->添加别名

Apache > 别名目录 > 添加别名

这将弹出一个终端窗口来创建别名。

别名终端window

在这里,您可以输入子目录部分名称,例如 http://localhost/site 中的 site 部分以及别名目录的路径,例如c:/projects/site,您可以从 Windows 目录地址栏复制该文件,然后将 shift + insert 复制到终端中。

如果您收到 403 Forbidden 错误(请参阅 这个问题)在浏览到您的别名目录时,从 WAMP UI 单击该别名目录并进行编辑,如下所示: 类似

Alias /site/ "C:\projects\site/" 

<Directory "C:\projects\site/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order allow,deny
    Allow from all
</Directory> 

Alias /site/ "C:\projects\site/" 

<Directory "C:\projects\site/">
    Options Indexes FollowSymLinks MultiViews
    Require local
</Directory> 

就可以开始了。如果它在一行中打开,请确保将其保留在一行中,否则 WAMP 将无法正确读取别名并上线。 (不知道为什么,可能与不兼容的行结尾或类似的东西有关。)

Following on from B Seven's comment: just go to your WAMP traybar icon, click on it and do the following:

Apache --> Alias directories --> Add an alias

Apache > alias directories > add an alias

This will pop up a terminal window to create the alias.

alias terminal window

Here you can enter in the subdirectory part name e.g. the site part in http://localhost/site and the path to your alias directory e.g. c:/projects/site, which you can copy from the Windows directory address bar and shift + insert into the terminal.

If you get a 403 Forbidden error (see this question) on browsing to your aliased directory, click on that alias directory from the WAMP UI and edit it such that:

Alias /site/ "C:\projects\site/" 

<Directory "C:\projects\site/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order allow,deny
    Allow from all
</Directory> 

Resembles:

Alias /site/ "C:\projects\site/" 

<Directory "C:\projects\site/">
    Options Indexes FollowSymLinks MultiViews
    Require local
</Directory> 

And you're good to go. If it opens in one line, make sure you keep it in one line or WAMP won't be able to read the alias properly and come online. (Not sure why, maybe to do with incompatible line endings or something of the sort.)

拥抱影子 2025-01-05 12:23:56

您可以使用 CMD mklink 功能来完成此操作。

Like(LINKFOLDER MOST NOT EXIST, IT WILL BE CREATED):

mklink /J LINKFOLDER ORIGINALFOLDER

或者将路径包含在引号中(如果有空格)。

mklink /J "LINK FOLDER" "ORIGINAL FOLDER"

成功的输出将是:

Junction created for LINKFOLDER <<===>> ORIGINALFOLDER

You can do this By using the CMD mklink function.

Like(LINKFOLDER MOST NOT EXIST, IT WILL BE CREATED):

mklink /J LINKFOLDER ORIGINALFOLDER

OR include the path in quotes if it has spaces.

mklink /J "LINK FOLDER" "ORIGINAL FOLDER"

Successful output will be:

Junction created for LINKFOLDER <<===>> ORIGINALFOLDER
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文