Is here someone or more who knows mod_rewrite and such Stuff?

Hello guys,

i’m sitting in front of my brand new website and i edit it without problems. But one thing is impossible to do for me. And that’s mod_rewrite, .htaccess and such stuff. I tried to find it through google but i’m too stupid finding a solution for it or i didn’t find a way which fitted for me.

Now my adress line looks like: https://www.domain.com/#tag1-tag2 or https://www.domain.com/#tag1
In the future it should look like this: https://www.domain.com/tag1
Simply told without the “#”.

I should tell you that the content is although different grouped in one index.html file. Every content contains an “id” like #tag1 for example. If someone is clicking now domain.com/#tag1 this content is delivered. But is it general possible to rewrite this URLs?

Would you help me?
Thank you. :innocent:

You need to test the # not sure it will work !
This would redirect to domain.com/index.html

RewriteEngine On
            RewriteCond %{HTTP_HOST} ^domain.com/#tag1$
            RewriteRule ^$ http://domain.com/index.html [L,R=301]
1 Like

Thank you @FLVAL.
Do i have to adopt these lines for every tag2, tag3 etc.?

RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.com/#blog$
RewriteRule ^$ http://domain.com/blog [L,R=301]
RewriteCond %{HTTP_HOST} ^domain.com/#hobbies$
RewriteRule ^$ http://domain.com/hobbies [L,R=301]

Dont know how this works.

Test already this one to see if it’s work with the #
Then if yes you will have to rework with RewriteRule :

RewriteRule ^(.*)([0-3]) ./index.html$

The idea is all that begins from anything one number would be interpreted as index.html
It seems you want to make a rule with your domain tag

Unfortunately it doesn’t work. I click onto the icon to swap to another page and in the adress line i can still see the #tag1.

I think the #tag1 need to be defined differently !
If you have a good Host you could ask them, they will help you to get what you want.

ok look below your # is only for client side, you couldn’t have it on Rewrite .htaccess

Okay, then i have to live with that, i guess. What a shame that it doesn’t work. Thank you for your help.

1 Like

Short update: My host want to get paid for this work, they obviously can create a solution which were tested and finished for 25 EUR. Nevertheless i will think about it a few days.

Thanks again for your help @FLVAL :+1:

1 Like

Yes, there is maybe a way to bypass # on the Apache but asks certainly to code something for it…
Often when it’s about .htaccess knows that host generally takes care of it and has control on it and could limit your use of it…

You have 2 solutions pay and get what you want or rethink your way with #tag !