我已经挠了很久。无法使其正常工作。(我是一个拥有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]
但是在所有这些情况下结果都是相同的。那是:
任何帮助将不胜感激Ahmar
在Retailer/.htaccess
文件中使用以下规则:
RewriteEngine on
RewriteBase /Retailer/
RewriteRule ^((?!public/).*)$ public/$1 [L,NC]
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句