【发布时间】:2014-02-23 06:33:54
【问题描述】:
我已经为此挠头很久了。无法让它工作。 (我是 apache 的菜鸟,这也是一个原因)。好的,简而言之就是问题所在。我正在使用 wamp,我有一个目录 Retailer。它里面还有另一个目录,称为 public ,其中包含索引和其他文件。我想让这个public 目录文档根。我想用.htaccess实现这个目标
我的 apache 重写模块已打开。
这是我尝试过的:
RewriteEngine on
RewriteBase /public/
RewriteRule ^index.php$ test.php
我也试过了
RewriteEngine on
RewriteCond %{HTTP_HOST} ^localhost/Retailer$ [NC,OR]
RewriteCond %{HTTP_HOST} ^localhost/Retailer$
RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) /public/$1 [L]
我试过了
RewriteEngine on
RewriteCond %{HTTP_HOST} ^http://localhost/Retailer/$ [NC,OR]
RewriteCond %{HTTP_HOST} ^http://localhost/Retailer/$
RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) /public/$1 [L]
但是所有这些情况的结果都是一样的。那是:
任何帮助将不胜感激 阿马尔
【问题讨论】:
-
你想在 wamp 上创建虚拟主机?
-
不,我想使用 .htaccess 更改文档根目录
-
此次更改后您想使用哪些 URL?
-
什么意思?当我访问 localhost/Retailer 时,它应该以 root 身份访问公共目录
-
您将在该链接中获得所有答案stackoverflow.com/questions/4383451/…