Help with URL extensions

Hello everyone,

I am for the first time trying to hide parts of the URL on my website.
I have successfully used RewriteEngine to hide the .html on 2 of my website pages.

On the homepage it does not show anything after the website domain/ upon navigating to the website but when you navigate back to it from one of the other website pages it shows the index.html after the “/” as well as the block on the page navigated to. See below:

http://tobylesauxsmith.co.uk/index.html#features11-2v

My problem is that my menu links navigate to sections on the index page, for example the “About” link takes you to the second block down on the home page not to the top of the page. (This works fine and does not show any extension when the page is first loaded, but not when navigating back to the index page.) When I remove the .html and everything after it in the {page}.html files the links do not know what block to navigate to and go to the top of the page.

My website is http://tobylesauxsmith.co.uk
I wish to hide everything after "tobylesauxsmith.co.uk/ " on the index page only.

Does anyone know how to do this?

I have looked around online but cannot find a solution for when you navigate to blocks on a page.

Thank you for your help

T

I have no idea what you are trying to do, but I will try to help anyways.

Take a look at the red underlines:

All of the links have
index.html#xyz
If you don’t want to show index.html, simply change them to
#xyz

In case you want nothing to display in the URL, no matter what you click, take a look at this:
<a href="#features11-2v" onclick="return false">About</a>

This will not add anything to your URL after /

If you were asking something else, please be a bit more clear.

Edit: use /#xyz instead of just #xyz

4 Likes

@TobyLesauxSmith
add this script to the bottom of each HTML file

<script>history.replaceState({}, document.title, "."); </script>

1

I think you no longer even needs a .htaccess

Please test

3 Likes

add also in portfolio HTML file !!

1 Like

Hi there,

Thanks both for your help.

I am trying to hide in the url everything that you have underlined in red Niekon^

The first method you suggested I tried but removing the index.html means that it no longer knows which page to navigate to. Also this still shows everything after the hashtag.
I also tried the onclick you sugested but this stoped the links from doing anything.

I tried this OXYDAC and it looks great in the URL bar but the links do not go to the right sections of the page and all navigate to the top. The about link needs to still navigate to the “about” block on the homepage not the top of the page etc.
Any ideas how to hide the extension like this method but not loose the links functions?

If you try the about link now on the homepage you will see it doesnt take the user to the right section anymore?

Thanks all for your help.

Ah sorry to see the issue i mean you have to be not on the homepage, try clicking the about link from the portfolio page for example^

to me everything works fine on FF

add that script to the bottom of each HTML file !

delete all browser cache
and visit http://tobylesauxsmith.co.uk/

3 Likes

I have deleted my cache and put this code on the html files.

If you go to http://tobylesauxsmith.co.uk/packages
and then try to click the about link at the top
it will navigate to the home page top
but should navigate to the second block down on the homepage
it seems that the hiding of the extension means it does not know which block to take the user to
do you see this issue?

Thanks

I repeat it works fine for me and jumps in About section
do I need to record a video? :slight_smile:
please add JS code in portfolio page also

2 Likes

Hmm this is odd, I have cleared my cache and tried 3 new browsers that the site is not loaded in and I have the same issue. It works from clicking “about” on the home page but from the “Packages” page and “portfolio” page clicking the “About” takes me to the top of the home page…

Thank you for your help, I am confused as to why this is not working for me.

1 Like

please add JS code in portfolio page also

1 Like

I have just added it to portfolio page too but the same issue from this page to the about section.

thanks you

1 Like

Thank you for your help, im not an expert in HTML I am more of a designer but I do have some experience and have a good grasp of how these things work but with this i’m struggling.

1 Like

NP and YW

I am very confused I will try another computer and see what happens. Have you done this with a cleared cache for my website? thank you

My other computer still faces this issue too…?

Sorry for the difficulty

how does it behave when you use this ? http://mobiletest.me/ipad_mini_emulator/?u=http://tobylesauxsmith.co.uk/
mouse click on your menu and test

1 Like

Thanks.

It does the same thing. I will try and record a video of it.

it does the same because it still uses your network
no need for video … I believe you …

please try this address in your browser http://www.tobylesauxsmith.co.uk/

2 Likes