【发布时间】:2016-05-14 23:37:53
【问题描述】:
我试图从 angular-urls 中删除“#”,我已经在前端进行了调整,例如
$locationProvider.html5Mode(true);
<base href="/*"> in my view file.
我在后端使用 express。虽然它运作良好,但是当我刷新页面时,它给了我错误 url not found.
我的默认 url 就像从 express 到渲染视图一样,
//server.js
app.use(express.static('app'));
var routes = require('./routes/index');
app.use('/', routes);
/routes/index
router.all('/', function(req, res) {
res.render('home');
});
如果我先点击http://localhost:1337/,它会起作用。它很好地移动到这个http://localhost:1337/first-param,但是当我直接点击http://localhost:1337/first-param而不去基本网址时,它给了我找不到错误。
请不要给我提示.htaccess。我不想使用.htaccess。
【问题讨论】: