Hashbang URL

Dear,

In my url there is always /#! /, I would like to get this away. The explanation to fix this is in this link: https://help.spreadshirt.com/hc/nl/articles/207487815 but it says that changes to the .htaccess file on your web server are necessary, what are these?

Hello Logomaker!

Making changes to server settings is not part of our technical support for the shop. Interventions within the common functionalities is not recommended to unexperienced users. We have developed the shop as a ready-to-go system. Custom settings are always on your own risk. Therefore we recommend to get in contact with any experienced developer or your hosting provider´s support.

But maybe there´s someone here in the forum community who´s able to support you. :wink:

Maybe this might show you the right direction:

2 Likes

I’d love to get this to work, but I’m strugling with the .htaccess. My shops are embedded on a Joomla! pages like so:

https://www.cardvibes.com/de/theme-t-shirt-shops/apres-ski-t-shirts

Any advice on what the .htaccess code should look like?

This is not easy, I’m not 100% .htaccess pro, but I think, this could be a good start:

In your joomla .htaccess, you’ve got something like:

## Begin - Joomla! core SEF Section.
#
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
#
# If the requested path and file is not /index.php and the request
# has not already been internally rewritten to the index.php script
RewriteCond %{REQUEST_URI} !^/index\.php
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script
RewriteRule .* index.php [L]
#
## End - Joomla! core SEF Section.

add before something like:

RewriteRule ^de/theme-t-shirt-shops/apres-ski-t-shirts/(.*)$ de/theme-t-shirt-shops/apres-ski-t-shirts/index.html$1 [L]

But this is untested and I don’t know it if will work in general. Maybe someone else has an idea :slight_smile:

2 Likes

Well in order to try things out, I’v created a test embedded page at:

https://www.tekenaartje.nl/spreadshop_test

Here I’ve set the usePushState variable to true. I would have expected not to see the #! anymore, but I do. What am I missing?

Well an error message pops up:
VM47 shop.bundle.65952a0b0f88e0f677eb7cefe7d70026b3e68080.js:171 [SpreadShop] The shop URL (see "Embed Shop" settings) does not start with the current path: Will fallback to hashbang URLs.

Maybe @Thomas_Spreadshop can check with the dev. team what this message really means :slight_smile:

1 Like

Good one. No idea where the shop url is set though…

1 Like

You integrated the shop at https://www.tekenaartje.nl/t-shirt-shop (which you configured correctly in the partner area) but you are testing the pushState integration at https://www.tekenaartje.nl/spreadshop_test. So the path does not match the configured one and we must fall back to the hashbang navigation. Either you test with your real shop at “t-shirt-shop” or you create a new test shop and configure it to “spreadshop_test”.

2 Likes

Thnx, I’m on it…

Well, I managed to get the usePushState param working on:
https://www.tekenaartje.nl/test-shop

Next challenge is to get the right .htaccess rewrite instructions for this case.

Currently, this line is active,

RewriteRule ^test-shop/(.*)$ test-shop/$1 [L]

but as you can see, it doesn’t work.

Ant suggestions?

Maybe

RewriteRule ^test-shop/(.*)$ test-shop/index.html$1 [L]

as I suggested before?

I’ve tried that first, but it doesn’t work.

There’s no index.html on the server. The location itself is a SEF Url generated by Joomla!.

Hey CardVibes,
Have you tried to reach out to Joomla’s service, yet?
I think it´s always helpful to ask the one´s that built the service. Maybe they are familiar with .js related URL behaviors. I guess there are several other .js related use cases too, which were supported by Joomla service agents.
:slight_smile:

also ich fände einen Ansatz für worpress cool :wink:

I’ve got it! One has to rewrite to the ugly / technical URL that goes behind the Joomla! SEf url. In my test case that’s:

RewriteRule ^test-shop/(.*)$ /index.php?option=com_spreadshop&view=shop&Itemid=598&lang=nl [L]

@lovetee many thanks for your assistance. I wouldn’t have figured it out without you.

1 Like

That’s it, man, you’re a pro! Great work!

2 Likes