.htaccess 为 vue SPA 应用程序禁用 javascript
.htaccess disables javascript for vue SPA app
我有一个使用路由器的 Vue 应用程序,我有一个用于(忘记密码)的路由,格式为 ../rp/:id,如下所示
export const routes = [
{
path: '/rp/:id',
name: 'resetPassword',
component: resetPassword,
props: true
}
]
const router = new vueRouter({
routes,
mode: 'history'
});
我使用 nodejs 作为后端并发送了电子邮件,但是当我单击电子邮件 link 将我重定向到 resetPassword 组件时,我得到了
很抱歉,如果不启用 JavaScript,应用程序将无法正常运行。请启用它以继续。
我正在使用 .htaccess 编写如下:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /Restaurant
RewriteRule ^Restaurant/index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /Restaurant/index.html [L]
</IfModule>
我不知道为什么它会禁用 javascript
我的index.html文件内容如下:
<!DOCTYPE html>
<html>
<head>
<noscript>
<strong>We're sorry but the app doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, shrink-to-fit=no">
<title>Restaurants</title>
</head>
<body style="height: 100vh">
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
谁能帮我解决这个问题?为什么它禁用 javascript?
提前致谢
是的!终于我让它工作了,这是一个非常愚蠢的错误,让我停止了 2 天
是 vue 路由器故障而不是 htaccess /Restaurant/rp/:id 不仅是 /rp/:id
如下:
export const routes = [
{
path: '/Restaurant/rp/:id',
name: 'resetPassword',
component: resetPassword,
props: true
}
]
const router = new vueRouter({
routes,
mode: 'history'
});
祝大家好运!
我有一个使用路由器的 Vue 应用程序,我有一个用于(忘记密码)的路由,格式为 ../rp/:id,如下所示
export const routes = [
{
path: '/rp/:id',
name: 'resetPassword',
component: resetPassword,
props: true
}
]
const router = new vueRouter({
routes,
mode: 'history'
});
我使用 nodejs 作为后端并发送了电子邮件,但是当我单击电子邮件 link 将我重定向到 resetPassword 组件时,我得到了
很抱歉,如果不启用 JavaScript,应用程序将无法正常运行。请启用它以继续。
我正在使用 .htaccess 编写如下:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /Restaurant
RewriteRule ^Restaurant/index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /Restaurant/index.html [L]
</IfModule>
我不知道为什么它会禁用 javascript
我的index.html文件内容如下:
<!DOCTYPE html>
<html>
<head>
<noscript>
<strong>We're sorry but the app doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, shrink-to-fit=no">
<title>Restaurants</title>
</head>
<body style="height: 100vh">
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
谁能帮我解决这个问题?为什么它禁用 javascript?
提前致谢
是的!终于我让它工作了,这是一个非常愚蠢的错误,让我停止了 2 天
是 vue 路由器故障而不是 htaccess /Restaurant/rp/:id 不仅是 /rp/:id
如下:
export const routes = [
{
path: '/Restaurant/rp/:id',
name: 'resetPassword',
component: resetPassword,
props: true
}
]
const router = new vueRouter({
routes,
mode: 'history'
});
祝大家好运!