0

I am trying to remove hash (#) from my url for this I did following steps

Config file

$locationProvider.html5Mode(true)

index file

<base href="/" />

.htaccess file

# Don't rewrite files or directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

# Rewrite everything else to index.html to allow html5 state links
RewriteRule ^ index.html [L]

After did all that my single routes like localhost/login is working but nested ui-routes are not like localhost/home/contact.

Another this if I direct hit localhost its show blank page.

All working fine with #.

Matko
  • 3,144
  • 4
  • 18
  • 31
yasir_mughal
  • 104
  • 10
  • I think you need to redirect to your hashed urls: Redirect 301 "/url" "/#!/url" this should still display as the unhashed urls in your browser – Groben Oct 09 '18 at 12:20
  • 1
    with ui-router there are **no such things as nested views** if you are using `html5mode`. A solution - design your website without nested views, or implement them manually (_without changes in URL_) – Aleksey Solovey Oct 09 '18 at 12:32
  • Have you tries this in your config file? $locationProvider.html5Mode(true).hashPrefix('!'); – saumil_ Oct 09 '18 at 12:42
  • There are several suggested answers on [this](https://stackoverflow.com/q/15385659/548997) question. – Lex Oct 09 '18 at 13:13
  • @saumil_jariwala yes I did. – yasir_mughal Oct 10 '18 at 04:54

0 Answers0