Nginx Clean url - html

I need clean urls for my website.
Html should be removed from the url name and if a website visitor should be able to visit my website without entering .html.
Can someone help me how to do this with the rewrite feature?
I use the Admin Software Plesk with the nginx Server!

You can read from the official blog or you can try something like this.
They must be inside location / {}
http://example.com/page
http://example.com/page.html
rewrite ^/page?$ /page.html last;

Related

¿How can i add a url path in html withoout a server, when click on about. Exist a meta name?

I need to change url with a click, without a server because i have in githubpages and domain in netlify, i know that maybe using npm and deploy a build but i want something more easy because the site is deploy and we don't want conflicts :( thanks community i try with meta property but cant, i have the hosting in github and just a index.html
I solve it in netlify,going to build and deploy then to Post processing and finally to Asset Optimization, the enable pretty urls, the engine read de href that have a html and clean a pretty url.

How to remove .index.html from URL?

I would like to know is it possible to remove index.html, info.html from the URL?
Also, what to add in
Start page
to make a start page like facebook.com. (Without facebook.com/index.html(php)?
You use this:
Start page
And you can set rewrite rules and stuff depending on server and access.
Wanna learn more, google for apache and rewrite rules and .htaccess if you are on an apache server. Else you are probably on a nginx server.

it is posible to get anotehr address from using pre-name on url?

If for example I have site call
xyz.com
how can I force my server(Asp.net/iis)
to go to another page if i ask for
a.xyz.com
it is posible?
for example: m.xyz.com leads to xyz.com/mobile.aspx
thanks!
The solution involves multiple steps:
You need to configure the subdomain in your DNS.
You need to create a website in IIS to handle the subdomain. There's a guide here on how to do this. Pay attention to the "Host Header" part - That's where you set you m.xyz.com address.
You need to setup an HTTP redirect (301 / 302). You can do this from the config file with the httpRedirect element (More details here).

Website Redirect Alternative - Two URLs to use same code base

Currently I have a redirect setup in my domain host's dns for example2.com to goto example.com
I don't want it to redirect but rather stay as example2.com while displaying the exact content from example.com. I don't want to copy the site's code between the two. I want a single code base and both URL's to use the same code.
I am not sure how to achieve this using my web host's CPanel. I thought I might be able to do it using cnames or aliases but that does not seem to work. I am sure someone has had this experience before.
I believe this is a pseudo-programming question but if a mod decides this is the wrong stack please do move it.
303 headers need to be sent with a new domain or in this case example.com, for apache or php related steps see these links:
http://www.inmotionhosting.com/support/website/htaccess/redirect-without-changing-url
redirect to a page without changing the url
Redirecting to HTTP error documents without changing the request URL
For explanations:
http://en.wikipedia.org/wiki/URL_redirection
http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection

301 Redirect directly in HTML file with nginx

I wonder if 301 redirect is possible in an exclusively html static nginx server?
I know that normally it is not possible to make redirect work in html only. In apache server, it is possible to make redirect by using .htaccess. I wonder if there is a similar way of doing this in nginx too?
Have you tried this? I remember testing this quite a while back and it worked for me. Let me know if you are able to get it working or I'll test it on my end