2

What i'm trying to do is quite simple but none of the stackoverflow answers address this exactly:

How do i use .htaccess to insert a hash tag in between the base url and the route requested?

ie

http://mydomain.com/shop  

will become

http://mydomain.com/#/shop

i want to use .htaccess because i feel like its a cleaner solution than server side php. it the reason i can do this is because i'm using jquery address which takes over the links on the page replacing the href attribute. it just breaks if the hash tag isn't properly getting put in.

O Red
  • 145
  • 2
  • 13
  • 1
    possible duplicate of [mod_rewrite with anchor link](http://stackoverflow.com/questions/2686075/mod-rewrite-with-anchor-link) – Phil Oct 24 '11 at 23:59

3 Answers3

2

Just use bog-standard mod_rewrite with the "no-escape" (NE) option:

RewriteRule ^shop /\#/shop [R=301,L,NE]
timdev
  • 61,857
  • 6
  • 82
  • 92
1

The hash/number symbol (#) itself has a special significance in a URL, so you cannot reliably place it into the path of your URL. You can do this:

RewriteRule ^shop(.*) /hash/shop$1 [R=301,L]
ghbarratt
  • 11,496
  • 4
  • 41
  • 41
0

Below code is helpful for deeplinking.You need to validate the browser and redirect to the app store if the module is not installed ,if installed means it will redirect to inside the app.

//Validate browser
if (strpos($_SERVER['HTTP_USER_AGENT'], 'Safari') == !FALSE) {
?>
<script>
    window.location = 'deeplinkexample://';
    setTimeout(function() {
        window.location = 'https://itunes.apple.com/us/app/apple/id1145838819?l=fr&ls=1&mt=8'
    }, 250);enter code here
</script>
<?php
}
Jeeva Chezhiyan
  • 218
  • 1
  • 9