【发布时间】:2017-05-19 15:06:55
【问题描述】:
laravel 框架中的 index.php 通常在 /public_html/public/ 文件夹中。 就我而言,它位于 /public_html 文件夹中
这是我的 .htaccess 文件中的代码
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
我应该做些什么改变来从 url 中排除 index.php ?
代码结构如下:
/public_html/sitemap.xml
/public_html/sitemap.htm
/public_html/server.php
/public_html/robots.txt
/public_html/readme.md
/public_html/index.php
/public_html/.htaccess
/public_html/public
/public_html/数据库
/public_html/config
/public_html/cgi-bin
/public_html/bootstrap
/public_html/app
在 /public_html/public 里面
/public_html/public/web.config
/public_html/public/robots.txt
/public_html/public/favicon.ico
/public_html/public/上传
/public_html/public/js
/public_html/public/img
/public_html/public/css
【问题讨论】:
-
不太精通 laravel(还),但我相信在 app.config 文件中,您可以设置应用程序的基本文件夹,从而避免所有 .htaccess 箍
-
如果你进入你的主页,你会看到你没有像
homepage.com/index.php那样得到它,而只是主页。你不需要改变任何东西。 -
您好!问题是谷歌已经索引了一些页面,它保存在搜索结果中的 url 是 homepage.com/index.php/company/punjab-communications-complaints/4165 我需要用 .htaccess 解决这个问题。有什么线索吗?
标签: .htaccess laravel url mod-rewrite hide