HTML POST重定向问题
HTML POST Redirection issue
我正在尝试为我的网站创建一个新的登录页面,我使用nodejs来创建登录部分。所以我使用html-post方法来传递参数。。所以基本上我有一个登录部分,注册部分和忘记密码部分。我把每个表单动作分别给了路径/本地、/注册和/忘记。。我只有一页的主题。因此只有一个索引文件可以处理所有这些特性。所以当我提交这些表格时。。。如果不合格,它将转到urlhttp://www.mycustomurl/local或http://www.mycustomurl/signup或http://www.mycustomurl/local/forgot并被重定向到这些页面。。我已经创建了index.html页面的副本,文件名为signup.html、local.html和forget.html。是否可以将表单提交重定向到当前页面本身??哪种方法最好?
如果我正确理解了你的问题,你应该可以用expressJS来解决。您可以设置不同的路由来提供相同的文件。这样的东西应该行得通。
app.post('local', function(request, response){
//your code that does stuff here
//if successful
//do your action
//if unsuccessful
//serve your single page
response.sendfile(path_to_file_index);
});
app.post('signup', function(request, response){
//your code that does stuff here
//if successful
//do your action
//if unsuccessful
//serve your single page
response.sendfile(path_to_file_index);
});
app.post('forgot', function(request, response){
//your code that does stuff here
//if successful
//do your action
//if unsuccessful
//serve your single page
response.sendfile(path_to_file_index);
});
可以通过.htaccess文件进行重定向:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.abc.com$ [NC]
RewriteRule ^(.*)$ http://www.abc.com/$1 [L,R=301]
或
RewriteEngine On
RewriteCond %{HTTP_HOST} !oldexample.com$ [NC]
RewriteRule ^(.*)$ http://www.newexample.com/$1 [L,R=301]
相关文章:
- Javascript移动站点重定向问题
- 移动网站重定向问题
- 登录后重定向,缓存页面问题-Javascript
- Javascript移动重定向问题
- Backbone.js路由器和Internet Explorer重定向问题
- Javascript/Ajax重定向问题
- angularjs中的重定向问题
- IE11 javascript重定向历史记录问题
- Facebook登录重定向问题
- 移动页面重定向问题
- 移动设备上的 iFrame 重定向主页问题
- 表单与 AppScript 重定向问题(XMLHttpRequest 无法加载)
- 重定向至“索引.html问题”诊断树
- PHP JavaScript 重定向问题
- JavaScript重定向Chrome问题
- 重定向HTML.BeginForm MVC 4的问题
- HTML POST重定向问题
- javascript重定向问题
- Node、express和angular的重定向问题
- ASP.NET MVC Javascript重定向编码问题