WebSite X5Help Center

 
John H.
John H.
User

Set up a webpage without the .html extension  en

Autore: John H.
Visite 1386, Followers 1, Condiviso 0  

Hi,

I have a website set up and now wish to direct some of my viewers to a particular webpage. 

This webpage would be www.mywebsite.com/computers without the viewer having to enter the .html after the website name.

I thought this was possible and have business cards printed already. I know I should have checked first but in my previous job this was possible to do.

Have done some trials with .htaccess but it doesn't work for me. Not very experienced with html hence I use Website X5 - lol

Any help would be much appreciated.

Stay safe.

John

Postato il
8 RISPOSTE - 6 UTILI - 1 CORRETTO
Adrian B.
Adrian B.
User

without the .html your users will get a 404 page.  business cards are cheap......

Leggi di più
Postato il da Adrian B.
Aleksej H.
Aleksej H.
Moderator

Hello.

"I know I should have checked first" - You are absolutely right.

"Any help would be much appreciated." - I agree with Adrian. You cannot configure redirects to URL without HTML. This is a feature of the X5.

But you can set up one redirect (in .htaccess) from www.mywebsite.com/computers to www.mywebsite.com/computers.html. Like this:

redirect 301 /computers https://www.mywebsite.com/computers.html

But you must consider your protocol: https or http.

Leggi di più
Postato il da Aleksej H.
John H.
John H.
User
Autore

Thanks Adrian and Aleksej

Thought it was worth a try, looks like it may be easier to either order new cards or just add .html to the cards. LOL

Aleksej, I tried the redirect 301 in .htaccess but unfortunately it doesn't work. Probably the way Crazy Domains don't have a root directory but a folder /httpdocs where the website is stored. I tried adding .htaccess in both the / and the /httpdocs folders with no luck.

At least you have sent me in the right direction and I will do some more searching on this redirect 301 rule.

Cheers guys.

John

Leggi di più
Postato il da John H.
Paul M.
Paul M.
Moderator

Hello John,

This should be possible but the procedure is different depending on whether you are hosted on Apache, nginx or Windows.  I presume you are on Apache given that you refer to .htaccess files, but are you completely certain about that?

Where are you trying to link from?  A text, an image, for example?  Or do you just want visitors to be able to type your URL into the address bar and go straight to your webpage?

If you can supply further details I will help you with this.

Kind regards,

Paul

Search the WebSite X5 Help Center

Leggi di più
Postato il da Paul M.
John S.
John S.
User

A possible solution is to make a subfolder.

In this subfolder place a file index.html

The only thing this file should contain is a redirect to your "real" site.

I think this is the simplest, cheapest  and easiest solution.

Then - next time you need a new set of business-cards then give them them the normal URL.

The normal url will of course function already - but doing it this way you will also be able to use the

www.mywebsite.com/computers

Leggi di più
Postato il da John S.
John S.
John S.
User

Forgot : the name of the subfolder should of course be computers

Leggi di più
Postato il da John S.
John H.
John H.
User
Autore

Hi guys, I would just like to thank you all for the great support and suggestions. I have found the solution that suits me best. It takes away the whole .html part from my website. I am on a Windows hosting plan by the way.

Just in case anyone else has this problem, here are the steps I have taken.

I had to create a file called web.config in my root directory and this has the following entries:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Hide .html ext">
<match ignoreCase="true" url="^(.*)"/>
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
<add input="{REQUEST_FILENAME}.html" matchType="IsFile"/>
</conditions>
<action type="Rewrite" url="{R:0}.html"/>
</rule>
<rule name="Redirecting .html ext" stopProcessing="true">
<match url="^(.*).html"/>
<conditions logicalGrouping="MatchAny">
<add input="{URL}" pattern="(.*).html"/>
</conditions>
<action type="Redirect" url="{R:1}"/>
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

I am now no longer required to enter .html on any of my URL's and all works great.

Thanks again to all.

Cheers - John

Leggi di più
Postato il da John H.
Paul M.
Paul M.
Moderator
John H.
I am on a Windows hosting plan by the way.

That's why your .htaccess instructions had no effect, John.

Anyway, glad you've resolved it to your satisfaction and thanks for letting us know the solution, which could help others on Windows servers.

Leggi di più
Postato il da Paul M.