首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >使用.htaccess从laravel中移除角型标签

使用.htaccess从laravel中移除角型标签
EN

Stack Overflow用户
提问于 2016-10-22 06:43:41
回答 1查看 508关注 0票数 2

我有代码点火器.htaccess文件,如

代码语言:javascript
运行
复制
<ifModule mod_rewrite.c>
RewriteEngine on

# allow social media crawlers to work by redirecting them to a server-rendered static version on the page

RewriteCond %{HTTP_USER_AGENT} (facebookexternalhit/[0-9]|Twitterbot|Pinterest|Google.*snippet)
RewriteRule eventApp/(\d*)$ [P]


# Required to allow direct-linking of pages so they can be processed by Angular
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*) /eventApp/index.html [NC,L]

</ifModule>

但我想从拉拉上去掉标签。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-10-22 09:00:50

要从URL片段中删除散列,只需设置角以不添加它,不需要修改.htaccess文件。因此,这个答案为提出的问题提出了一个更明确的解决办法。

在你的角基模块中,通常是在你定义路线的地方。

代码语言:javascript
运行
复制
angular.module('app', [])
    .config([
        '$routeProvider', 
        '$locationProvider', 
        function($routeProvider, $locationProvider) {
            // Hashtags no longer appear with this
            $locationProvider.html5Mode(true);

            // Route definitions below
        }]);

您还需要在base视图中设置header元素。这是用角来确定它在构造URL时应该使用的路径。这个例子将使用根。

代码语言:javascript
运行
复制
<!doctype html>
<head>
    <title>Laravel</title>
    <base href="/" />
</head>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40189153

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档