【发布时间】:2015-07-17 14:07:39
【问题描述】:
我有一个 Laravel 项目
我的域名是domain.com.tw
并且网址将是domain.com.tw/public,
页面可以显示了。
我想删除网址中的public,
所以我在.htaccess 中写了RewriteRule:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
但这对我不起作用 我也看过这些,但仍然失败
Apache Mod Rewrite For Laravel
Laravel 4.2 rewrite URL - remove public
谁能告诉我解决方案?谢谢!!
【问题讨论】:
-
您使用的是 laravel 4 或 5 如果 5 您可以将外部公共目录中的 .htaccess 文件移动到根文件夹,然后将根文件夹中的 server.php 文件重命名为 index.php跨度>
-
您好我在这个项目中使用 Laravel 4.2,所以 .htaccess 已经在根文件夹之外,是否还需要将 server.php 重命名为 index.php ?
-
在 L5 中是这样,所以在 L4 中尝试一下
-
如何将 apache 配置中的文档根目录从“your/path/to/laravel”更改为“your/path/to/laravel/public”
标签: php .htaccess mod-rewrite url-rewriting public