0

I use Apache server in my PC. I read some tutorials for remove # sign from URL in angularJS app. Apache server replace all files of directive into index.html. while file name is same but it's content replace with index.html file content. please help me out. I add some code into C:\xampp\apache\conf\httpd.conf

# <VirtualHost> definition.  These values also provide defaults for
<VirtualHost *:8000>
    ServerName localhost

    DocumentRoot "C:/xampp/htdocs/googleSignin/"

    <Directory "C:/xampp/htdocs/googleSignin/">
        RewriteEngine On  
  # If an existing asset or directory is requested go to it as it is
  RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
  RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
  RewriteRule ^ - [L]

  # If the requested resource doesn't exist, use index.html
  RewriteRule ^ /index.html
    </Directory>
</VirtualHost>
# any <VirtualHost> containers you may define later in the file.

enter image description here look into figure angular.min.js file change into index.html

Sandeep
  • 1,461
  • 13
  • 26

1 Answers1

0

It's not working because you can't remove the hash parameter from a URL at the server level. The server never gets it, which you can verify by looking at the Apache logs.

To remove it with ui-router, you need to set it to html5mode and then it'll be in a URL format that your server can intercept:

app.config(["$locationProvider", function($locationProvider)
{
    $locationProvider.html5Mode(true);
}]);

https://github.com/angular-ui/ui-router/wiki/Frequently-Asked-Questions#how-to-configure-your-server-to-work-with-html5mode

bbrown
  • 6,370
  • 5
  • 37
  • 43
  • Thanks for your answer. But I already set Html5Mode true... My problem is different. Why all file content change to index.html file. See above picture. – Sandeep Feb 13 '16 at 04:42
  • In the screenshot above, do the contents of `appjs.js` get loaded or is it too `index.html`? *NEVER MIND* I see the error its request produces. – bbrown Feb 15 '16 at 18:22