我克隆了聚合物入门套件,它运行得非常好。
因此,在占位符路由中有一个名为http://localhost:5000/users/Rob.如果我通过点击Rob链接从用户页面移动到Rob页面,上面的url就会起作用。
但是如果我直接粘贴http://localhost:5000/users/Rob在浏览器上按enter键,它不起作用。
我认为以上问题可以通过使用htaccess来解决。但不知道怎么做。
下面是我的.htaccess代码
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /index.html [L,R=302]
tryhttp://localhost:5000/#/users/Rob。
#!链接中的标签和感叹号作为文件夹?
删除[L,R=302]
对我很有帮助!
.htaccess:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /
index.html:
<app-route
route="{{route}}"
pattern="/users/:id"
data="{{usersRouteData}}"
tail="{{usersSubroute}}"
active="{{usersActive}}"
></app-route>