I have the project folder where i have some html pages and i have the admin folder where i have the login and dashboard pages. The project is in some location http://localhost:8080/index.html. Now if the user types /admin eg. http://localhost:8080/admin i want to show the login page and am not using any backend language, how to do this. Can anyone tell me how to solve this issue.
Asked
Active
Viewed 52 times
-1
-
What is name of login page in admin folder? Is something like 'login.html'? – Sagar Mar 01 '19 at 05:15
-
Possible duplicate of [How to remove .html from URL?](https://stackoverflow.com/questions/5730092/how-to-remove-html-from-url) – User863 Mar 01 '19 at 05:15
-
@Sagar it is login.html – Sam Mar 01 '19 at 05:22
-
What web server are you using? – Brad Mar 01 '19 at 05:32
-
@ Brad Apache web server – Sam Mar 01 '19 at 05:41
2 Answers
0
You can use ngnix for client side project to redirect the request to index.html
server_name admin;
location /admin/ {
proxy_pass http://127.0.0.1:8080;
proxy_redirect / $request_uri;
}

Nithya Rajan
- 4,722
- 19
- 30
-
-
you should install ngnix and inside the html folder you should paste your project. inside the config file you should add what i have answerd. I hope you know tamil – Nithya Rajan Mar 01 '19 at 05:25
-
-
should i paste the code in the nginx.conf file .I am not using any php code for this – Sam Mar 01 '19 at 05:56
-
no php is needed. you can just paste this in your ngnix config. or share me your config file and foder structure – Nithya Rajan Mar 01 '19 at 06:00
-
my folder structure is project index.html, contact.html, about.html ,admin in this folder i have login.html and dashboard.html – Sam Mar 01 '19 at 06:25
-
Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/189242/discussion-between-bear-nithi-and-lakshmi-priya). – Nithya Rajan Mar 01 '19 at 06:36
-1
If file name is not given in the url then web servers look for index files in this order
index.html
index.htm
default.html
default.htm
home.html
home.htm
Index.html
Index.htm
Default.html
Default.htm
Home.html
Home.htm
rename your login.html file to one of the above.

Sagar
- 430
- 4
- 14
-
The configuration of these pages is anything but universal, and is not guaranteed. – Brad Mar 01 '19 at 05:31
-
-
@lakshmipriya My answer was considering IIS is your web server. May be you should look into apache web server configuration. http://httpd.apache.org/docs/2.2/mod/mod_dir.html#directoryindex https://www.mkyong.com/apache/how-to-set-change-default-page-in-apache/ – Sagar Mar 01 '19 at 08:02