I am trying to create a new login page for my website and I was using nodejs to create the login part. so I use the html post method to pass parameters.. so basically I have a sign in part, sign up part and forgot password part. Ive each form action given to path /local , /signup and /forgot respectively..Ive a single page theme. so there is only one index file which handlese all these features. so when I submit these forms... if its unsuccesul it will go to the url http://www.mycustomurl/local or http://www.mycustomurl/signup or http://www.mycustomurl/local/forgot and gets redirected to these pages.. and I have created duplicates of page index.html with filenames signup.html, local.html and forgot.html. Is it possible to redirect the form submit to current page itself?? Which is the best method?
If I have understood your problem correctly, you should be able to do it with expressJS. You can set up different routes to serve the same files. Something like this should work.
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);
});
Redirection is possible via a .htaccess file:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.abc.com$ [NC]
RewriteRule ^(.*)$ http://www.abc.com/$1 [L,R=301]
OR
RewriteEngine On
RewriteCond %{HTTP_HOST} !oldexample.com$ [NC]
RewriteRule ^(.*)$ http://www.newexample.com/$1 [L,R=301]